Difference between revisions of "Command:If"

From Lavish Software Wiki
Jump to navigation Jump to search
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Syntax ==
+
#REDIRECT [[Control:If..Else]]
{{CMD-DR|If|Intermediate|Intermediate|Beginner|Intermediate}}
 
 
 
<tt>If <condition></tt>
 
 
 
== Description ==
 
Conditionally executes the following command, depending on the value of an expression.  The condition is run through a [[LavishScript:Mathematical Formulae|math calculator]].  If the result is zero, the command is skipped; otherwise it is executed.  Command blocks may be used, which begin with a <tt>{</tt> and end with a <tt>}</tt>, and is treated by control statements such as if it were a single command (i.e. executed or skipped as a whole).
 
 
 
When using characters which have special meaning in LavishScript commands, such as <tt>< |</tt> and <tt>></tt>, enclose the statement in quotes (see [[LavishScript:Syntax|Syntax]]).
 
  if "2 > 1"
 
 
 
== Examples ==
 
  if x == 5
 
  {
 
    if y == 6
 
      varset z 17
 
  }
 
  else
 
    varset z 20
 
 
 
== See Also ==
 
*[[LavishScript:Commands|Commands]]
 
*[[LavishScript:Syntax|Syntax]]
 
*[[Command:Else|Else]]
 
*[[LavishScript:Mathematical Formulae|Mathematical Formulae]]
 
 
 
[[Category:LavishScript]] [[Category:LavishScript Commands]]
 

Latest revision as of 02:36, 13 September 2005

Redirect to: