This project is read-only.

Condition

A condition allows a specific block of code to be run only if a certain expression evaluates to a logical true value. The syntax is as follows:

var a = true
if a do print "everything's okay" 

It's simple: first the if keyword, then the expression, then do and action!

If you need more than one statement to run when the condition matches, surround them with curly braces:

var a = true
if a do
{
  a = false
  println "yay!"
} 

Else

You can also specify a block of code that would be executed if the condition isn't met with the else keyword:

var data = io:read
if data.is_i do
{
  print "your number is ", data
}
else
{
  print "not a number!"
} 

Related pages: Visibility scopes, Convertors

Last edited Mar 17, 2011 at 10:13 AM by impworks, version 1

Comments

No comments yet.