Difference between revisions of "If else"

From Second Life Wiki
Jump to navigation Jump to search
 
Line 1: Line 1:
{{LSL Header}} __NOTOC__
{{LSL_Conditional
{{LSL Generic
|statement=dowhile
|{{{statement}}}|
|statement_header
|header_floater
|statement_desc=Any of the statements can be null statements.
|header_text={{LSL_Generic/Text
|statement_title=if(condition) branch_true else branch_false
|header_footnote
|p1_name=condition|p1_desc=If this executes as true then '''branch_true''' is executed otherwise '''branch_false''' is executed.
|p1_name=loop
|p2_name=branch_true|p2_desc=Can be either a single statement, a block statement, or a null statement.
|p1_desc=Executes once, then executes '''condition'''.
|p3_name=branch_false|p3_desc=Can be either a single statement, a block statement, or a null statement.
|p2_name=condition
|constants
|p2_desc=If condition executes true, it then loops back and executes '''loop''' again.
}}
|header_title={{LSL_Generic/Title
|name=do loop while
|template=none
|p1_name=condition
|return_end=<nowiki>;</nowiki>}}
|deprecated
|constants_nb={{LSL Constants Conditional}}
|spec
|spec
|caveats
|caveats
Line 22: Line 13:
|helpers
|helpers
|also_header
|also_header
|also_events
|also_functions
|also_functions
|also_tests
|also_tests
Line 29: Line 19:
|notes
|notes
|mode
|mode
|self
|deprecated
|type=flow control
|cat1
|template=LSLG
|cat2
|footer=<div style="font-size:x-small;">This page is based on information gathered from the Second Life client {{HoverText|source|'linden\indra\newview\app_settings\keywords.ini'}}, and as such has additional [http://secondlife.com/developers/opensource/licenses licensing restrictions].</div>}}
|cat3
{{LSLC|Flow Control|if-else}}
|cat4
}}

Revision as of 15:21, 8 February 2007

if(condition) branch_true else branch_false

•  condition If this executes as true then branch_true is executed otherwise branch_false is executed.
•  branch_true Can be either a single statement, a block statement, or a null statement.
•  branch_false Can be either a single statement, a block statement, or a null statement.


Any of the statements can be null statements.

Specification

Conditional Types
Type Condition
integer True if it is not zero.
float True if it is not zero.[1]
string True if its length is not zero.
key True only if it is a valid key and not NULL_KEY.
vector True if the vector is not ZERO_VECTOR.
rotation True if the rotation is not ZERO_ROTATION.
list True if the length is not zero. Note that correct behavior is only seen with Mono-compiled scripts; LSO-compiled scripts incorrectly resolve to false if the list is non-empty: BUG-230728

Examples

Deep Notes

Search JIRA for related Issues

Footnotes

  1. ^ The OpenSim LSL compiler will not do this implicitly. You will need to use an explicit check.