beautypg.com

Teledyne LeCroy LeCroy Analyzers File Based Decoding Manual User Manual

Page 20

background image

Chapter 4: Operators

File-based Decoding User Manual

14

LeCroy Corporation

Assignment Operators (continued)

&=

Bitwise AND
assignment

Integer-integer

Integer

a

= 0b11111110

a

&= 0b01010101 = 0b01010100

^=

Bitwise exclusive
OR assignment

Integer-integer

Integer

e

= 0b11111110

e

^= 0b01010101 = 0b10101011

|=

Bitwise inclusive
OR assignment

Integer-integer

Integer

i

= 0b11111110

i

|= 0b01010101 = 0b11111111

List Operators

sizeof()

Number of
elements

Any

Integer

sizeof([1, 2, 3]) = 3

sizeof('0011223344') = 5

sizeof("string") = 6

sizeof(12) = 1

sizeof([1, [2, 3]]) = 2
*Note: the last example demonstrates that the
sizeof()

operator returns the shallow count of a

complex list.

head()

Head

List

Any

head([1, 2, 3]) = 1
*Note: the Head of a list is the first item in the list.

tail()

Tail

List

List

tail([1, 2, 3]) = [2, 3]
*Note: the Tail of a list includes everything except
the Head.

first()

Returns the first
element of the list
and resets the list
iterator to the
beginning of the list

List

Any

list = [1, 2, 3];

for( item = first(list);

more(list); item = next(list) )

{

ProcessItem( item );

}

next()

Returns the next
element of the list
relative to the
previous position of
the list iterator

List

Any

list = [1, 2, 3];

for( item = first(list);

more(list); item = next(list) )

{

ProcessItem( item );

}

Operator
Symbol

Description

Operand Types

Result
Types Examples

Table 4.2 Operators (Continued)