Teledyne-lecroy CATC Scripting Language Reference Manual Uživatelský manuál Strana 25

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 57
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 24
C
HAPTER
7
Statements
CATC Scripting Language
21
if ( 3 - 3 || 2 - 2 ) Trace ( "Yes" );
else Trace ( "No" );
will cause “No” to be printed, because 3 - 3 || 2 - 2 will evaluate to False
(neither 3 - 3 nor 2 - 2 is nonzero).
while Statements
A while statement is written as
while <expression> <statement>
An example of this is
x = 2;
while ( x < 5 )
{
Trace ( x, ", " );
x = x + 1;
}
The result of this would be
2, 3, 4,
for Statements
A for statement takes the form
for (<expression1>; <expression2>; <expression3>)
<statement>
The first expression initializes, or sets, the starting value for x. It is executed one
time, before the loop begins. The second expression is a conditional expression. It
determines whether the loop will continue -- if it evaluates true, the function keeps
executing and proceeds to the statement; if it evaluates false, the loop ends. The
third expression is executed after every iteration of the statement.
Figure 7-1: Execution of a for
statement
Zobrazit stránku 24
1 2 ... 20 21 22 23 24 25 26 27 28 29 30 ... 56 57

Komentáře k této Příručce

Žádné komentáře