-
Notifications
You must be signed in to change notification settings - Fork 0
Conditional Structures
Davis Brown edited this page Aug 28, 2018
·
5 revisions
SQF++ supports the standard set of conditional structures, although with a more traditional syntax.
Every conditional structure (Except switch
) also supports a single statement, non-block alternative.
if (true) _x = player();
if (5 < 1) {
// if true ..
}
if (5 < 1) {
// if true ..
} else {
// if false ..
}
if (5 < 1) {
} else if (5 < 2) {
} else if (5 < 3) {
} else {
}
Indexed For-Loop
for(var _i = 0; _i < 10; _i += 1) {
_i *= 2;
}
Foreach-Loop
for(var _element : _list) {
// _element refers to the currently iterated element
}
var _x = 0;`
while (_x < 5) {
_x += 1;
}
switch (5) {
case 0: {
// ..
break;
}
case 5: {
// ..
break;
}
default: {
// ..
}
}