301
if
Syntax
if
logicalExpression
then
statement
if
logicalExpression
then
statement
else
statement
end if
if
logicalExpression
then
statement(s)
end if
if
logicalExpression
then
statement(s)
else
statement(s)
end if
if
logicalExpression1
then
statement(s)
else if
logicalExpression2
then
statement(s)
else if
logicalExpression3
then
statement(s)
end if
if
logicalExpression1
then
statement(s)
else
logicalExpression2
end if
Description
Keyword;
if...then
structure that evaluates the logical expression specified by
logicalExpression
.
•
If the condition is
TRUE
, Lingo executes the statement(s) that follow
then
.
•
If the condition is
FALSE
, Lingo executes the statement(s) following
else
. If no statements
follow
else
, Lingo exits the
if...then
structure.
•
All parts of the condition must be evaluated; execution does not stop at the first condition that
is met or not met. Thus, faster code may be created by nesting
if...then
statements on
separate lines instead of placing them all on the first line to be evaluated.
When the condition is a property, Lingo automatically checks whether the property is
TRUE
. You
don’t need to explicitly add the phrase
= TRUE
after the property.
The
else
portion of the statement is optional. To use more than one
then-statement
or
else-statement
, you must end with the form
end if
.
The
else
portion always corresponds to the previous
if
statement; thus, sometimes you must
include an
else nothing
statement to associate an
else
keyword with the proper
if
keyword.
Note:
A quick way to determine in the script window if a script is paired properly is to press Tab. This forces Director to
check the open Script window and show the indentation for the contents. Any mismatches will be immediately apparent.
Examples
This statement checks whether the carriage return was pressed and then continues if it was:
if the key = RETURN then go the frame + 1
Содержание DIRECTOR MX-LINGO DICTIONARY
Страница 1: ...Lingo Dictionary Macromedia Director MX...
Страница 756: ...Index 756...