Difference between revisions of "Core.Actions.Loop.WhileLoop"
Jump to navigation
Jump to search
(Created page with "Category:Core == Classification == {{ClassificationActivity | WhileLoop | Loop that is iterated until the condition evaluates to false. | Action | Core|OTX Core libr...") |
|||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | [[Category:Core]] | + | {{DISPLAYTITLE:OTX '''WhileLoop'''}}[[Category:Core]] |
== Classification == | == Classification == | ||
{{ClassificationActivity | WhileLoop | Loop that is iterated until the condition evaluates to false. | [[Action]] | [[Core|OTX Core library]] | [[Core related actions]] | - | - }} | {{ClassificationActivity | WhileLoop | Loop that is iterated until the condition evaluates to false. | [[Action]] | [[Core|OTX Core library]] | [[Core related actions]] | - | - }} | ||
+ | |||
+ | == OTL Syntax == | ||
+ | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
+ | // While (do) | ||
+ | while (BooleanTerm) : WhileLoopName | ||
+ | { | ||
+ | ... | ||
+ | } | ||
+ | |||
+ | //Do while | ||
+ | do | ||
+ | { | ||
+ | ... | ||
+ | } while (BooleanTerm) : WhileLoopName | ||
+ | </syntaxhighlight> | ||
== Description == | == Description == | ||
Line 13: | Line 28: | ||
{| {{TableHeader}} | {| {{TableHeader}} | ||
{{TableRowPropertiesHeader}} | {{TableRowPropertiesHeader}} | ||
− | {{TableRowPropertie1| IsPostTested | [[Boolean]] | [[Value]] | - | [0..1] | The condition is tested before the execution of the loop (while false) or afterwards (true, do-while)}} | + | {{TableRowPropertie1| IsPostTested | [[Core.DataTypes.SimpleDataType.Boolean|Boolean]] | [[Value]] | - | [0..1] | The condition is tested before the execution of the loop (while false) or afterwards (true, do-while)}} |
− | {{TableRowPropertie2| Test | [[Boolean]] | [[Term]] | - | [1] | Continue the loop condition expression}} | + | {{TableRowPropertie2| Test | [[Core.DataTypes.SimpleDataType.Boolean|Boolean]] | [[Term]] | - | [1] | Continue the loop condition expression}} |
|} | |} | ||
+ | |||
+ | == OTL Examples == | ||
+ | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
+ | Integer Integer1; | ||
+ | |||
+ | while (Integer1 < 10) : WhileLoop1 | ||
+ | { | ||
+ | Integer1 = (Integer1 + 1); | ||
+ | } | ||
+ | |||
+ | do | ||
+ | { | ||
+ | Integer1 = (Integer1 + 1); | ||
+ | } while (Integer1 < 10) : WhileLoop2 | ||
+ | </syntaxhighlight> | ||
== See also == | == See also == | ||
− | [[ForLoop]] <br/> | + | [[Core.Actions.Loop.ForLoop|ForLoop]] <br/> |
− | [[ | + | [[Core.Actions.Loop.ForEachLoop|ForEachLoop]] |
Latest revision as of 10:21, 4 February 2016
Classification
Name | WhileLoop |
Short Description | Loop that is iterated until the condition evaluates to false. |
Class | Action |
Extension | OTX Core library |
Group | Core related actions |
Exceptions | - |
Checker Rules | - |
Standard Compliant | Yes |
OTL Syntax
// While (do)
while (BooleanTerm) : WhileLoopName
{
...
}
//Do while
do
{
...
} while (BooleanTerm) : WhileLoopName
Description
The OTX (do) WhileLoop activity contains a sequence of activities that are executed repeatedly until the condition evaluates to false. The expression for the condition is either before (while) or calculated according to (do while) the loop and tested.
![]()
Please keep in mind that Do While at least once iterate loop!
The loop can be exited about the activities of break, return, or throw. The continue activity stops the current iteration and continues with the next iteration, without having to leave the loop.
Properties
Name | Data Type | Class | Default | Cardinality | Description |
IsPostTested | Boolean | Value | - | [0..1] | The condition is tested before the execution of the loop (while false) or afterwards (true, do-while) |
Test | Boolean | Term | - | [1] | Continue the loop condition expression |
OTL Examples
Integer Integer1;
while (Integer1 < 10) : WhileLoop1
{
Integer1 = (Integer1 + 1);
}
do
{
Integer1 = (Integer1 + 1);
} while (Integer1 < 10) : WhileLoop2