PickBASIC / FlashBASIC
ifr statement
.mdThe ifr statement tests the result of a logical expression.
Syntax
Description
Each attribute of the first element of the expression is tested against the target. Depending on whether one of the attributes in the expression evaluates to either true or false, the statements following the then or else clauses, respectively, are executed.
mvBase: For a program compiled in mvBase compatibility mode, the ifr
statement differs as follows:
- The list of values to compare against is separated by a value mark rather than an attribute mark.
- The list of values is used on the right side of the equation rather than the left side of the equation.
Example(s)
Example 1
001 print "Input string":;input str2 002 str1="a":@am:"b" 003 ifr str1=str2 then print "match" else print "no match" run bp testifr Input string?a match run bp testifr Input string?b match run bp testifr Input string?ab no match
Example 2
Example ifr statement for mvBase compatibility mode:
001 print "Input string":;input str2 002 str1="a":@vm:"b" 003 ifr str2=str1 then print "match" else print "no match" run bp testifr Input string?a match run bp testifr Input string?b match run bp testifr Input string?ab no match