by Brayla Sana | Apr 19, 2016 | Flow Control, LSL, OSSL, Wiki
A do-while loop is similar to a while loop, but the order in which the parts are executed is different. Format do { statements } while (condition); Example do { llSay(0, “monkey!”); } while (monkeysRemain()); This code will say...
by Brayla Sana | Apr 19, 2016 | Flow Control, LSL, OSSL, Wiki
Flow control statements control when and where code is executed (how it flows). The following keywords are parts of LSL flow control. Keyword Purpose if-else Execute some statements if a condition is true, other statements otherwise. while Execute some statements as...
by Brayla Sana | Apr 19, 2016 | Flow Control, LSL, OSSL, Wiki
The for loop is used to execute statements while a condition is true, and executes a line of code after each iteration/cycle/step. More commonly, it executes code a certain number of times, and operates a counter to facilitate it. Format: for (initialization; test;...
by Brayla Sana | Apr 19, 2016 | Flow Control, LSL, OSSL, Wiki
Execute some statement(s) if a condition is true, else some other statement(s) if it is false. This is essentially the “bread and butter” of coding: the decision making inside a script. if (condition) statement else statement if (condition) {...
by Brayla Sana | Apr 19, 2016 | Flow Control, LSL, OSSL, Wiki
jump label A jump is like a goto in other languages. Jumps can be used to alter normal flow control. When a jump occurs, script execution immediately moves to the next statement after the corresponding label definition, skipping intervening code and breaking out...
by Brayla Sana | Apr 19, 2016 | Flow Control, LSL, OSSL, Wiki
A return is a value given when exiting a function or event. The return keyword is used for exiting from functions or events. If a function has a return value, all code paths will need to end in a return statement. Note: The term “return value” is used when...