or: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
Lou Montana (talk | contribs) m (Add since template usage) |
||
Line 25: | Line 25: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|s2= a [[or]] b | |s2= a [[or]] b {{since|arma2oa|1.62|y}} |SYNTAX2= | ||
|p21= a: [[Boolean]] - test condition or variable |PARAMETER21= | |p21= a: [[Boolean]] - test condition or variable |PARAMETER21= | ||
Line 36: | Line 36: | ||
|x1= <code>[[if]] (_obj1 [[or]] (_enemycount [[==]] 0) [[or]] ([[not]] [[alive]] _enemyGeneral)) [[then]] { [[hint]] "you win !"; };</code> |EXAMPLE1= | |x1= <code>[[if]] (_obj1 [[or]] (_enemycount [[==]] 0) [[or]] ([[not]] [[alive]] _enemyGeneral)) [[then]] { [[hint]] "you win !"; };</code> |EXAMPLE1= | ||
|x2= <code>{{cc|without lazy evaluation [[select]] would throw an error | |x2= <code>{{cc|without lazy evaluation, [[select]] would throw an error in the event of an empty array}} | ||
[[if]] (([[count]] _array [[==]] 0) [[or]] { (_array [[select]] 0) [[!=]] [[player]] }) [[then]] { | [[if]] (([[count]] _array [[==]] 0) [[or]] { (_array [[select]] 0) [[!=]] [[player]] }) [[then]] | ||
{ | |||
[[hint]] "It works!"; | [[hint]] "It works!"; | ||
};</code> |EXAMPLE2= | };</code> |EXAMPLE2= | ||
Line 43: | Line 44: | ||
| [[a or b|a || b]], [[and]], [[Operators]]|SEEALSO= | | [[a or b|a || b]], [[and]], [[Operators]]|SEEALSO= | ||
}} | }} | ||
Line 55: | Line 55: | ||
<h3 style="display:none">Bottom Section</h3> | <h3 style="display:none">Bottom Section</h3> | ||
[[Category:Scripting Commands OFP 1.46|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting Commands OFP 1.46|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Scripting Commands OFP 1.96|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting Commands OFP 1.96|{{uc:{{PAGENAME}}}}]] |
Revision as of 22:28, 23 December 2020
Description
- Description:
- Returns true if one or both conditions are true. In case of the alternative syntax, lazy evaluation is used (if left operand is true, evaluation of the right side is skipped completely).
- Groups:
- MathVariables
Syntax
- Syntax:
- a or b
- Parameters:
- a: Boolean - test condition or variable
- b: Boolean - test condition or variable
- Return Value:
- Boolean
Alternative Syntax
- Syntax:
- a or b Template:since
- Parameters:
- a: Boolean - test condition or variable
- b: Code - code that returns Boolean; it is not evaluated if a returns true
- Return Value:
- Boolean
Examples
- Example 1:
if (_obj1 or (_enemycount == 0) or (not alive _enemyGeneral)) then { hint "you win !"; };
- Example 2:
// without lazy evaluation, select would throw an error in the event of an empty array if ((count _array == 0) or { (_array select 0) != player }) then { hint "It works!"; };
Additional Information
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
Categories:
- Scripting Commands
- Introduced with Operation Flashpoint version 1.00
- Operation Flashpoint: New Scripting Commands
- Operation Flashpoint: Scripting Commands
- Command Group: Math
- Command Group: Variables
- Scripting Commands OFP 1.46
- Scripting Commands OFP 1.96
- Scripting Commands OFP 1.99
- Scripting Commands Armed Assault
- Scripting Commands Arma 2
- Scripting Commands Arma 3
- Scripting Commands Take On Helicopters