else: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " <h3 style="display:none">Notes</h3> <dl class="command_description"> <!-- Note Section BEGIN --> <!-- Note Section END --> </dl> " to "")
m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments( \("local" or "global"\))?|Effects|Multiplayer Effects( \("local" or "global"\))?|Multiplayer Exe...)
Line 1: Line 1:
{{Command|Comments=
{{Command


| ofpr |Game name=
| ofpr


|gr1= Program Flow |GROUP1=
|gr1= Program Flow


|1.85|Game version=
|1.85


| Executes [[else]] code when [[if]] condition returns [[false]]|DESCRIPTION=
| Executes [[else]] code when [[if]] condition returns [[false]]


| ifCode '''else''' elseCode |SYNTAX=
| ifCode '''else''' elseCode


|p1= ifCode: [[Code]] |PARAMETER1=
|p1= ifCode: [[Code]]


|p2= elseCode: [[Code]]|PARAMETER2=
|p2= elseCode: [[Code]]


| [[Array]] |RETURNVALUE=
| [[Array]]


|x1= <code>[[if]] (a > b) [[then]] { c = 0 } [[else]] { c = 1 };</code> |EXAMPLE1=
|x1= <code>[[if]] (a > b) [[then]] { c = 0 } [[else]] { c = 1 };</code>


|x2= <code>[[if]] (a < b) [[then]] {
|x2= <code>[[if]] (a < b) [[then]] {
Line 23: Line 23:
} [[else]] {
} [[else]] {
     [[hint]] "A is greater than B";
     [[hint]] "A is greater than B";
};</code> |EXAMPLE2=
};</code>


| [[Control Structures]], [[if]], [[then]] |SEEALSO=
| [[Control Structures]], [[if]], [[then]]


}}
}}

Revision as of 01:37, 18 January 2021

Hover & click on the images for description

Description

Description:
Executes else code when if condition returns false
Groups:
Program Flow

Syntax

Syntax:
ifCode else elseCode
Parameters:
ifCode: Code
elseCode: Code
Return Value:
Array

Examples

Example 1:
if (a > b) then { c = 0 } else { c = 1 };
Example 2:
if (a < b) then { hint "B is greater than A"; } else { hint "A is greater than B"; };

Additional Information

See also:
Control Structuresifthen

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Bottom Section