Foreach; Next; (Null Statement) - Red Hat ENTERPRISE LINUX 5.4 - SYSTEMTAP LANGUAGE Reference Manual

Systemtap language reference
Hide thumbs Also See for ENTERPRISE LINUX 5.4 - SYSTEMTAP LANGUAGE:
Table of Contents

Advertisement

Chapter 6. Statement types
for (EXP1; EXP2; EXP3) STMT
The for statement is similar to the for statement in C. The for expression executes EXP1 as
initialization. While EXP2 is non-zero, it executes STMT, then the iteration expression EXP3.

6.6. foreach

General syntax:
foreach (VAR in ARRAY) STMT
The foreach statement loops over each element of a named global array, assigning the current key
to VAR. The array must not be modified within the statement. If you add a single plus (+) or minus (-)
operator after the VAR or the ARRAY identifier, the iteration order will be sorted by the ascending or
descending index or value.
The following statement behaves the same as the first example, except it is used when an array is
indexed with a tuple of keys. Use a sorting suffix on at most one VAR or ARRAY identifier.
foreach ([VAR1, VAR2, ...] in ARRAY) STMT
The following statement is the same as the first example, except that the limit keyword limits the
number of loop iterations to EXP times. EXP is evaluated once at the beginning of the loop.
foreach (VAR in ARRAY limit EXP) STMT
6.7. if
General syntax:
if (EXP) STMT1 [ else STMT2 ]
The if statement compares an integer-valued EXP to zero. It executes the first STMT if non-zero, or
the second STMT if zero.
The if command has the same syntax and semantics as used in C.

6.8. next

The next statement returns immediately from the enclosing probe handler.

6.9. ; (null statement)

General syntax:
30

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ENTERPRISE LINUX 5.4 - SYSTEMTAP LANGUAGE and is the answer not in the manual?

Questions and answers

Table of Contents