loading

If Statement

The If Statement module allows you to create a condition on which the enclosed modules will get executed or not. This is similar to the conditional statements seen in the VBScript and other scripting languages. Using the interface you can compare RoboRealm variables against other variables or values to determine if the following modules should be executed or not.

Interface

Instructions

1. Variable - Specify the variable to test using the dropdown menus. Select [new] to create a new variable that is not already in the list.

2. Comparison - Select the appropriate comparison.

equals - true if the variable and value are equal.

not equals - true if the variable and value are not equal

greater than - true if the variable is greater than the value. For numbers this is a direct comparison, for text the order is alphabetical.

greater or equal to - true if the variable is greater than or equal to the value.

less than - true if the variable is less than the value. For numbers this is a direct comparison, for text the order is alphabetical.

less or equal to - true if the variable is less than or equal to the value.

contains - true for text comparisons where the variable has the specified value as a sub component (i.e. word) within in. For example, "The dog jumped over the fence" contains "dog".

does not contain - true if for text comparisons where the variable does NOT contain the specified value. For example, "The dog jumped over the fence" does NOT contain "cat".

is within - true for text comparisons where the variable is within (present in) the value. For example, "dog" is within "The dog jumped over the fence". This is logically the opposite of the "contains" comparison.

is not within - true for text comparisons where the variable is NOT within (absent from) the value. For example, "cat" is not within "The dog jumped over the fence". This is logically the opposite of the "does not contain" comparison.

starts with - true for text comparisons where the variable starts with the specified value. For example, "The dog jumped over the fence" starts with "The dog".

not starts with - true for text comparisons where the variable does not start with the specified value. For example, "The dog jumped over the fence" does not start with "The cat".

ends with - true for text comparisons where the variable ends with the specified value. For example, "The dog jumped over the fence" ends with "fence".

not ends with - true for text comparisons where the variable does not end with the specified value. For example, "The dog jumped over the fence" does not end with "wall".

is null - true if the variable either contains zero (for numbers) or an empty string "" for text.

is not null - true if the variable either contains a non-zero value or has some text even if a single letter.

is a multiple of - true for numeric comparisons where the variable is a multiple of the specified value (aka modulus). For example, 4 is a multiple of 2 since 4 mod 2 or 4 % 2 is zero.

is not a multiple of - true for numeric comparisons where the variable is not a multiple of the specified value (aka modulus). For example, 5 is not a multiple of 2 since 5 mod 2 or 5 % 2 is 1.

3. Type - Select the comparison type. The comparison type helps specify how the comparison is performed. For example, if two strings "100" and "2" are compared as text "2" will be greater than "100", but if compared as integers then "100" will be greater than "2".

4. Value - Specify the value to compare to. For variables use the dropdown list. For other static values such as numbers or strings simply type in the value. You can also use the expressions in the value field to test variables based on mathematical expressions of other variables/numbers.

5. Join - Specify the type of join to perform on multiple conditions

6. Latch - Select the Latch Condition if you only want the If Statement to trigger when the condition transitions from false to true, i.e. once true, the condition will not trigger until the condition evaluates to false and then true again.

See Also


Set Variable


 New Post 

If_Statement Related Forum PostsLast postPostsViews
Write Images Module and Timer Module
Hi there, I am trying to figure out a way to capture images from a video camera feed for every 5 seconds. The Write Images modul...
4 year 2 2285
soccer robot
hi Steve i'm developing  Soccer Robot with RoboRealm . I can detect the ball now but i want to detect another object a...
5 year 2 1800
If statement
I am developing a defect detection system and I would like to trigger the detection once an edge of a board has been detected. I...
6 year 2 1916
Vb script to determine ball in region
I need help to determine ball position in 4 quadrant, which is quadrant 1 to quadrant 4 by using the line as  i attach...
7 year 2 2174
Speak within an if Statement
Hi, I seem to have a problem with an If statement. When I place Speak within the If statement , no speech is heard...
8 year 2 2102
Constant Variable
I'm new to RoboRealm and I'm trying to make a program to detect certain objects. I have filters that filter out everything but t...
8 year 2 2199
Bug in multiline cut and if statement
If you try to cut a complete if statement till its end with a multiline cut, things get messed up pretty bad....
9 year 2 2467
Bug with double if creation
Ich you create two if statement directly in sequence, mark the second one and move it upwards, in walks into the first if. OK. T...
9 year 2 2304
Testing an integer array for emptyness
Hi, I need to test in a robo file if there exists a Harris_Corner, how can I achieve it? Does "if H...
10 year 2 2544
RGB Filter
Is there a way to turn one RGB filter on and turn another off?...
10 year 4 3676
Move if-statements more easily.
I've found it very difficult to move if and endif statements around. If you accidentally move an endif statement above its if s...
10 year 2 2511
To insert a module in the Pipeline
Hi to the users of this forum, I have a question to do, and I hope that someone has a solution.
11 year 5 3326
Audio
Hi. I have a problem with the audio. For example, when I include a format. Wav or beep in a state i...
11 year 4 3046
Display data from Pic
Is it possible to display the data from the Pic. I can see the PIC data I have got it to send in t...
12 year 6 3122
compairing variables
How would i compair the the COLOR_SAMPLE_NEAREST Variable from the sample color function to a preset variable in an if command?...
12 year 4 2695
Timer and If Statement Module
For some reason I cannot for the life of me get the If Statement Module to work with a "timer" value.  All I'm tryi...
12 year 2 2576
about using many modules
looking at using a few modules and making robo files how do  i use like follow red object,then irobot ro...
13 year 4 3120
Else block disabled
Hi everyody, I'm using an If statement in my .robo, and I need an Else block with it. But no matte...
13 year 2 3345