Teledyne-lecroy FireInspector - File Based Decoding Manual do Utilizador Página 14

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 74
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 13
8
CATC SCRIPTING LANGUAGE 1.0 CHAPTER 3
Reference Manual Expressions
x = 10
Value_of_x = select {
x < 5 : "Less than 5";
x >= 5 : "Greater than or equal to 5";
};
The above expression will evaluate to “Greater than or equal to 5” because the first
true expression is x >= 5. Note that a semicolon is required at the end of a
select expression because it is not a compound statement and can be used in an
expression context.
There is also a keyword default, which in effect always evaluates to true. An
example of its use is
Astring = select {
A == 1 : "one";
A == 2 : "two";
A == 3: "three";
A > 3 : "overflow";
default : null;
};
If none of the first four expressions evaluates to true, then default will be eval-
uated, returning a value of null for the entire expression.
select expressions can also be used to conditionally execute statements, similar
to C switch statements:
select {
A == 1 : DoSomething();
A == 2 : DoSomethingElse();
default: DoNothing();
};
In this case the appropriate function is called depending on the value of A, but the
evaluated result of the select expression is ignored.
Vista de página 13
1 2 ... 9 10 11 12 13 14 15 16 17 18 19 ... 73 74

Comentários a estes Manuais

Sem comentários