Page 92 - Ai Robogenius
P. 92
Logic–Operators
Operators are used to perform calculations within your program. These can be used to change
the values of variables, control movement speeds or check distances.
Some of the important Operators blocks are as follows:
Block Description
0 + 0 This block performs basic arithmetic operations, like addition
(+), subtraction (-), multiplication (*) and division (/).
= This block compares two values using operators like equal to
0 50
(==), less than (<) and greater than (>).
This block performs logical operations: and (true only if both
and
conditions are true) and or (true if at least one condition is true).
not This block reverses the truth value of a condition.
This block compares multiple conditions using operators like
0 < 0 < 0 less than (<), greater than (>), less than or equal to (≤) and
greater than or equal to (≥).
convert 0 to text This block converts a number into either text or number format.
Ask AIRO
Make a program that uses a variable to count how many times the robot turns right.
Logic-Events
In VEXcode VR, event blocks are used to start specific actions or behaviours when certain
conditions are met, like when an event happens or when the program begins. These blocks help
the robot react to inputs or events, making the programming more interactive and dynamic.
Some of the important Events blocks are as follows:
Block Description
This block is triggered automatically when the project starts.
when started
It begins the actions of the script when the program runs.
This block executes a script when the specified event is
when I receive my_event
received. You can trigger actions based on specific events.
This block broadcasts the event to all other scripts, notifying
broadcast my_event
them that the event has occurred.
This block broadcasts the event and pauses the script until
broadcast my_event and wait
the event is received by other scripts before continuing.
AI RoboGenius - VIII
90

