Curl Global Community
Page 7: Summary - Printable Version

+- Curl Global Community (http://communities.curl.com)
+-- Forum: Tutorials (http://communities.curl.com/forumdisplay.php?fid=3)
+--- Forum: Public Training (http://communities.curl.com/forumdisplay.php?fid=4)
+---- Forum: Curl IDE Made Easy (http://communities.curl.com/forumdisplay.php?fid=6)
+----- Forum: Try 2: Making a Simple Action Game (http://communities.curl.com/forumdisplay.php?fid=10)
+----- Thread: Page 7: Summary (/showthread.php?tid=53)



Page 7: Summary - ashimo - 06-16-2011

TRY 2 Overview

Event handler structure



on

Code:
{on event-type do body}
{on event-type at target-var[:target-type] do body}
{on event-var:event-type at target-var[:target-type] do body}

where
  • event-var:event-type: binds a variable to the event.
  • target-var[:target-type]: binds a variable to the target.
  • body is the code for the event handler procedure.



Branching expressions



if

Code:
{if condition-1 then
    code-block-1
elseif condition-2 then
    code-block-2
elseif condition-3 then
    code-block-3
    ...
elseif condition-n then
    code-block-n
[else
     code-block-n+1]
}

where
  • condition-1, condition-2, ...: are Boolean expressions.
  • code-block-1, code-block-2, ...: each consist of one or more Curl language expressions.



switch

The switch expression has the following syntax:

Code:
{switch compare-expr [using compare-operator]
     case value-1 do
        code-block-1
     case value-2 do
        code-block-2
        ...
     case value-n do
        code-block-n
        [else code-block-n+1]
    }


where
  • compare-expr, value-1, value-2, value-n: are Curl language expressions. These expressions can evaluate to any Curl language type.
  • compare-operator: the operator that the Curl language uses when comparing compare-expr to value-1, value-2, and so on.
  • code-block-1, code-block-2, code-block-n: consist of one or more Curl language expressions.



Types of graphical containers