User Tools

Site Tools


syntax:functions:if

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
syntax:functions:if [2021/08/11 14:16] craigtsyntax:functions:if [2021/08/11 14:21] – [Examples] dmitry
Line 4: Line 4:
 \\  \\ 
 =====Description===== =====Description=====
-This action creates binary decision logic by evaluating the supplied //condition// and returning the //when_true// value if the condition is true, or //when_false// if not.+This function evaluates //condition// and returns the //when_true// value if the condition is true, or //when_false// if not.
  
 \\  \\ 
Line 19: Line 19:
  
 If() functions can be nested to provide decisions based on more than a single test, and return a value from more than just two choices.  See examples below. If() functions can be nested to provide decisions based on more than a single test, and return a value from more than just two choices.  See examples below.
 +
 +Both //when_true// and //when_false// values are always evaluated, even if only one of them is returned.
  
 \\  \\ 
Line 24: Line 26:
  
   if(2+2=4, "Yes it does", "No it doesn't") = "Yes it does"  //Returns the text value.   if(2+2=4, "Yes it does", "No it doesn't") = "Yes it does"  //Returns the text value.
 +
   if("This" = "That", 1, 0) = 0  //Returns numeric zero.   if("This" = "That", 1, 0) = 0  //Returns numeric zero.
 +
   if(rem(4,2)=0,"Number is even","Number is odd") = "Number is even"  //Using a function in the condition.   if(rem(4,2)=0,"Number is even","Number is odd") = "Number is even"  //Using a function in the condition.
 +
   if({MyVal}+6=8,"MyVal is 2","MyVal is not 2") = "MyVal is not 2"  //Where "MyVal" = 3, parameters are supported.   if({MyVal}+6=8,"MyVal is 2","MyVal is not 2") = "MyVal is not 2"  //Where "MyVal" = 3, parameters are supported.
 +
 \\  \\ 
 ====Nested if()s==== ====Nested if()s====
syntax/functions/if.txt · Last modified: 2021/08/16 02:42 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki