Web+ Tutorial

Previous

  Contents  

Next

Lesson 4.1 - Conditional Execution (webIf...webElseIf...webElse)

Description
Allows conditional execution, based on the evaluation of an expression.
Syntax
<webIf #conditions#>
    [instructions]
[<webElseIf #conditions#>
    [instructions]]
[<webElse>
    [instructions]]
</webIf>

Agument
/tutorial/argument/arg14.wml
Example
<webIf #accidents = 0#>
    The highway status is good.
</webIf>

<webIf #temperature Lt 20#>

    <webIf #temperature Gt 10#>
      Temperature is within tolerance.
    </webIf>
</webIf>

<webIf #i Lt 10#>

    <webPrint>#i#</webPrint> is less than 10.
<webElseIf #i = 10#>
    <webPrint>#i#</webPrint> is equal to 10.
<webElse>
    <webPrint>#i# is larger than 10.
</webIf>

<webIf #(month = "July") && (day = 4)#>

    <webPrint>Today is the #Day#th of #month#.</webPrint>
</webIf>

Exercise

You can try out some Web+ code of your own here.

Previous

  Contents  

Next

 

Copyright © 2009 Webplus, Inc. (talentsoft). All Rights Reserved.
webmaster@webplus.com