if. Choose one of the two branches

^if(logical expression){code to implement if condition is "true"}

^if(logical expression){
    code to implement if condition is true
}{
    code to implement if condition is false

}

^if(logical expression 1){
    code to implement if condition 1 is true
}(logical expression 2){
    code to implement if condition 2 is true
}…(logical expression N){
    code to implement if condition N is true
}{
    code to implement if condition N is false
}
   [3.4.1]

First, operator evaluates specified expression. Then, it decides whether to implement the code or not (first example), or whether to follow the first or the second branch (second example). There are no limitations imposed on the code. For example, it may also contain one or more
if-statements.

Important notice: we do recommend that you add comments to parts of complex mathematical expressions (see "Adding comments to parts of expressions").


Copyright © 1997–2021 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 26.02.2011