Syntax![]() UseThe instruction evaluates the left expression, finds an The Note:
The code associated with the
IF or ELSE case can be
surrounded with ( ) (round brackets) or { } (curly
brackets).The return value is empty if no case matches the result of the left expression. Note:
The
return type of all cases must be compatible, otherwise to avoid compilation errors you can
return an empty value with a correct type in some cases.
Example1TMP absolute := number < 0 IF TRUE: (-number) ELSE: number; TMP hasFailed := message IFRE "(?i)Error|Failed": TRUE ELSE: FALSE; Example2Prerequisite: reqSpec is an element of Requirement Specification class.
reqSpec.getAllRequirements.{
name
IF "Req1":{
EACH.description;
}
IF "Req2":{
EACH.Title
}
ELSE:{
EACH.name
}
}
| |||||||||