7-10 Programming
Expressions
Trio Motion Technology
Example 1:
You can assign the result of an expression to a variable,
num_widgets = total_length / widget_length
has three operands,
num_widgets, total_length
and
widget_length
and two operators,
=
(assignment) & / (divide).
Reading the above as simple English would equate to:
Divide the variable
total_ length
by
widget_length
and assign the result to
the variable
num_widgets
Example 2:
you could use an expression directly:
MOVE(widget_length+10) ‘
(MOVE is a Trio BASIC instruction)
Example 3:
Sometimes an expression is used to make a decision..
IF batch_count = batch_size THEN GOTO batch_done