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
syntax:functions:if [2021/08/11 14:16] craigtsyntax:functions:if [2021/08/16 02:42] (current) – [Examples] craigt
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.
  
 \\  \\ 
 =====Examples===== =====Examples=====
  
-  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"//Returns "Yes it does" 
-  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("This" = "That", 1, 0) //Returns 0  (Returns a numeric zero.
-  if({MyVal}+6=8,"MyVal is 2","MyVal is not 2""MyVal is not 2"  //Where "MyVal" = 3, parameters are supported.+ 
 +  if(rem(4,2)=0,"Number is even","Number is odd"//Returns "Number is even"  (Using a function in the condition.
 + 
 +  if({MyVal}+6=8,"Is 2","Is not 2"//Returns "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