else: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[Category:[ _]?Scripting[ _]Commands[ _]Arma[ _]2(\|.*)\]\]" to "{{GameCategory|arma2|Scripting Commands}}")
m (Text replacement - "_{10,} " to "")
Line 1: Line 1:
{{Command|Comments=
{{Command|Comments=
____________________________________________________________________________________________


| ofpr |Game name=
| ofpr |Game name=
Line 7: Line 6:


|1.85|Game version=
|1.85|Game version=
____________________________________________________________________________________________


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


| ifCode '''else''' elseCode |SYNTAX=
| ifCode '''else''' elseCode |SYNTAX=
Line 19: Line 16:


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


|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> |EXAMPLE1=
Line 28: Line 24:
     [[hint]] "A is greater than B";
     [[hint]] "A is greater than B";
};</code> |EXAMPLE2=
};</code> |EXAMPLE2=
____________________________________________________________________________________________


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

Revision as of 01:12, 17 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

Notes

Bottom Section