[If Expressions][Then]do this[/Then][Else]otherwise this[/Else][/If]
To display some HTML (or execute WebDNA [xxx] tags) only if certain conditions are met, place the text inside an [If] context. The comparison, which may contain any [xxx] tags, is first evaluated to see if it is true, and if true then the contained [Then] context is executed (or simply displayed, if it's just HTML). If not true, then the contained [Else] context is executed (or simply displayed, if it's just HTML). See [Then] and [Else].
Example (normally you would put the following text into a .tpl file on your server and use a web browser to link to it):
[If (("[username]"="Grant")  ([grandTotal]<100)) & ({[date]}<{2/15/2000})]
[Then]either username was Grant or grandTotal was < $100 and it's not Feb 15, 2000 yet[/Then]
[Else]The complex expression wasn't true[/Else]
[/If]
Comparisons are always caseinsensitive so "grant" equals "GRANT". The expression is evaluated as a mathematical boolean equation, where each subexpression evaluates to either 0 or 1 (meaning true or false). If the entire evaluated expression is true, then the WebDNA inside the [Then] contexxt is executed, otherwise the [Else] context is executed. The [Math] context has been extended to allow for quoted text and boolean operators, and is actually what is used by [If] to perform the work of evaluating the expression. A sideeffect of this allows you to use these operators inside a [math] equation: [math]1<3[/math] evaluates to "1", because the equation is true. Conversely, [math]3<1[/math] evaluates to "0" because the equation is false. Similarly, [math]1&1[/math] evaluates to "1", and [math]1&0[/math] evaluates to "0".
Comparison  Example  

equal 
=  [If "[username]" = "SAGEHEN"] variable [username] is equal to SAGEHEN 
not equal 
!  [If [random] ! 45] random number is not 45 
contains 
^  [If "[browsername]" ^ "Mozilla"] variable [browsername] contains the text Mozilla 
begins with 
~  [If "[ipaddress]" ~ "245.078.013"] variable [ipaddress]
begins with 245.078.013 Notice the IP address has been typed with 3 digits in each portion of the address. This is very important for making these comparison work as expected. 
less than 
<  [If [random] < 50] random number is less than 50 
greater than 
>  [If [lastrandom] > 25] last random number is greater than 25 
divisible by  \  [If [index] \ 3] variable [index] is divisble by 3 
or    [If (5>4)  (1<3)] Boolean comparison: if either side of the operator is true, then the comparison is true 
and  &  [If (5>4) & (1<3)] Boolean comparison: if both sides of the operator are true, then the comparison is true 
Delimiter  Example  
Quoted Text

"..."  [If "Hello" ^ "hell"] All text must be surrounded by quotes 
Numbers  [If 12.5 < 13.2] Numbers do not need to be delimited; they function the same as in a [Math] context  
Dates  {}  [If {[date]} > {9/7/1963}] Dates must be enclosed in curly braces to distinguish them from regular numbers 
Times  {}  [If {[time]} > {12:31:00PM} Times must be enclosed in curly braces to distinguish them from regular numbers 
Parentheses 
(...)  [If (3>1) & ("a"<"b")] You may collect groups of items in parentheses in order to force the order of evaluation 