Talk:If
I would appreciate an example that shows the appropriate "if / elseif / else" construction. I assume that this will work:
if (a == "Loren") { llSay(0, "Lorem ipsum sic amet!"); } else if (a == "Bob") { llSay(0, "Babble dabble rabble rouse."); } else { llSay(0, "Gobbledygook? or English?"); }
- Kendown Baroque 12:12, 29 August 2007 (PDT)
This page is missing documentation on one of the major flaws of the LSL if() else() statement. When writing an if() else(), residents need to know that there is a limit of 23 else() statements (not including the first if() statement). Further documentation of this limitation including a workaround can be found in the if() statement article at http://rpgstats.com/wiki/index.php?=Ifelse . I would add this documentation myself but I'm not sure how or where in the article to add it.
Kaiden Ruxton 23:47, 18 January 2008 (PST)
- It looks like this limit is no longer in existence. i tested it with 50 else if and got a friend who tested about 120 without an error in LSL2 or mono. the connected jira VWR-811 is marked as resolved since about a week too. So the info can be removed?
- Lynch (talk|contribs) 03:20, 29 October 2008 (UTC)
It seems LSL parses if statements right to left.
Ex: if(a==3 && (a=3) && (a=4))llSay(0, "After statement: "+(string)a);
This will output "After statement: 3"
--Jasdac Stockholm (talk) 06:43, 31 January 2015 (PST)