then: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
m (added see also)
Line 1: Line 1:
#REDIRECT [[Control Structures#if-Statement]]
{{Command|= Comments
____________________________________________________________________________________________


| ofpr |= Game name
|1.85|= Game version
____________________________________________________________________________________________
| First or second element of array is executed depending on result of [[if]] condition. Result of the expression executed is returned as a result (result may be nothing).  |= Description
____________________________________________________________________________________________
| if '''then''' else |= Syntax
|p1= if: [[If Type]] |= Parameter 1
|p2= else: [[Array]] |= Parameter 2
| [[Anything]] |= Return value
____________________________________________________________________________________________
|x1 = <code>[[if]] (a>b) then <nowiki>{c=1}</nowiki> [[else]] <nowiki>{c=2}</nowiki></code> | = Example 1
|x2 = <code>[[if]] (a>b) then <nowiki>{c=1;c=2}</nowiki></code>| = Example 2
| [[Control Structures]] |= See also
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands|THEN]]
[[Category:Scripting Commands|THEN]]
[[Category:Scripting Commands OFP 1.96|THEN]]
[[Category:Scripting Commands OFP 1.96|THEN]]
[[Category:Scripting Commands ArmA|THEN]]
[[Category:Scripting Commands ArmA|THEN]]
[[Category:ArmA: Control Structures|THEN]]
[[Category:Command Group: Program Flow|THEN]]

Revision as of 15:40, 15 January 2007

Hover & click on the images for description

Description

Description:
First or second element of array is executed depending on result of if condition. Result of the expression executed is returned as a result (result may be nothing).
Groups:
Uncategorised

Syntax

Syntax:
if then else
Parameters:
if: If Type
else: Array
Return Value:
Anything

Examples

Example 1:
if (a>b) then {c=1} else {c=2}
Example 2:
if (a>b) then {c=1;c=2}

Additional Information

See also:
Control Structures

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