2 logical or operator, 6 simple assignment, 7 size of array – ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 84: Logical operators, Bitwise exclusive or (^), Bitwise inclusive or (|), Simple assignment, Size of array

Advertising
background image

5.4.1.5.2 Logical OR Operator

The logical OR operator (||) returns the integer value 1 if either operand is nonzero;
otherwise, it returns 0. Logical OR has left-to-right associativity.

Syntax

logical-or-expression :

expression || expression

expression:

logical-or-expression

The operands to the logical OR operator must be an integer type. The operands are
commonly relational or equality expressions.

The first operand is completely evaluated and all side effects are completed before
continuing evaluation of the logical OR expression.

5.4.1.6

5.4.1.7

Maestro

Software Manual

MAXL Program Language

MAN-MASSW (Ver. Q)

Simple Assignment

The simple assignment operator (=) causes the value of the second operand to be
stored in the object specified by the first operand. If both objects are of arithmetic
types, the right operand is converted to the type of the left, prior to storing the value.

Size of Array

MAXL’s array supports a “size” operator. This operator retrieves the size of an array.

Syntax

array-size:

array-name.size

This operator may be useful in the next construction:

Example:

int a[10] // declaration global array

function run() // begin of function declaration

global int a[] // global array declaration inside function body

int I // declare local variable

for i=0:(a.size-1) // loop from 0 to 9

// 10 is retrieved from the global array declaration

// 10-1 is 9

a[i]=1 // set each array element to 1

end

for

end function // end of function declaration

5-22

Advertising