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

  • 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 14
C
HAPTER
4
Operators
CATC Scripting Language
11
Operator
Symbol
Description
Operand
Ty
p
es
R
esult
Ty
p
es
Examples
Index Operator
[
]
Index or
subscript
Raw Bytes
Integer
Raw = '001122'
Raw[1] = 0x11
List
Any
List = [0, 1, 2, 3, [4, 5]]
List[2] = 2
List[4] = [4, 5]
List[4][1] = 5
*Note: if an indexed Raw value is assigned to any
value that is not a byte ( > 255 or not an integer), the
variable will be promoted to a list before the
assignment is performed.
Associative Operator
(
)
Associative
Any
Any
( 2 + 4 ) * 3 = 18
2 + ( 4 * 3 ) = 14
Arithmetic Operators
*
Multiplication
Integer-integer
Integer
3
*
1
=
3
/
Division
Integer-integer
Integer
3
/
1
=
3
%
Modulus
Integer-integer
Integer
3
%
1
=
0
+
Addition
Integer-integer
Integer
2
+
2
=
4
String-string
String
"one " + "two" = "one two"
Raw byte-raw byte
Raw
'001122' + '334455' =
'001122334455'
List-list
List
[1, 2] + [3, 4] = [1, 2, 3, 4]
Integer-list
List
1 + [2, 3] = [1, 2, 3]
Integer-string
String
"number = " + 2 = "number = 2"
*Note:
integer-string concatenation
uses decimal
conversion.
String-list
List
"one" + ["two"] = ["one", "two"]
-
Subtraction
Integer-integer
Integer
3
1
=
2
Increment and Decrement Operators
++
Increment
Integer
Integer
a
=
1
++a
=
2
b
=
1
b++ = 1
*Note that the value of b after execution is 2.
--
Decrement
Integer
Integer
a
=
2
--a
=
1
b
=
2
b--
=
2
*Note that the value of b after execution is 1.
Table 4.2: Operators
Zobrazit stránku 14
1 2 ... 10 11 12 13 14 15 16 17 18 19 20 ... 56 57

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

Žádné komentáře