|
Conditional statements are used to perform different actions based on different conditions, giving your program the ability to follow or not follow a "branch" of program code.
In Miva Script we have the following conditional statements
Attributes
ExamplesExample:<MvIF EXPR = "{ condition }"> Execute the code here if this condition is true, otherwise skip it. </MvIF> In this example the code executed branches based on the system clocks current hour of the day, where LT means Less Than. See Operators Example:<MvIF EXPR = "{ s.tm_hour LT 12 }"> Good Morning.<br> <MvELSE> Good Afternoon.<br> </MvIF> Multiple conditions can be used to determine which of several block s of code to execute. Example:<MvIF EXPR = "{ g.month LE 3 }"> First Quarter.<br> <MvELSEIF EXPR="{ g.month LE 6 }"> Second Quarter.<br> <MvELSEIF EXPR="{ g.month LE 9 }"> Third Quarter.<br> <MvELSE> Fourth Quarter.<br> </MvIF> Nested ConditionalsYou can nest <MvIF> tags--that is, enclose one inside another. You must make sure that each <MvIF> tag has a corresponding </MvIF> end-tag. Indenting nested tags is not required but it makes your code more readable. Example:<MvIF EXPR="{age GE 17}"> This person may be eligible to drive a motor vehicle.<br> <MvIF EXPR="{age GT 80}"> This person requires a re-examination.<br> </MvIF> The license fee is $40.75.<br> </MvIF>
|