a == b: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
[[Category:Scripting Commands|#]]
[[Category:Scripting Commands OFP 1.96|#]]
[[Category:Scripting Commands OFP 1.46|#]]
[[Category:Scripting Commands ArmA|#]]
<h2 style="color:#000066">''' ''valuea'' == ''valueb'' '''</h2>
<h2 style="color:#000066">''' ''valuea'' == ''valueb'' '''</h2>


Line 49: Line 43:
The workaround for the second line is:<br>
The workaround for the second line is:<br>
? ([[count]] MyArray) '''==''' 0 : [[hint]] "This is a test."
? ([[count]] MyArray) '''==''' 0 : [[hint]] "This is a test."
[[Category:Scripting Commands|#]]
[[Category:Scripting Commands OFP 1.96|#]]
[[Category:Scripting Commands OFP 1.46|#]]
[[Category:Scripting Commands ArmA|#]]
[[Category:Command_Group:_Variables]]

Revision as of 20:25, 9 August 2006

valuea == valueb


Operand types:

valuea: Number, Group, Side, String, Object, Structured Text, Config, Display or Control

valueb: Number, Group, Side, String, Object, Structured Text, Config, Display or Control

Type of returned value:

Boolean

Description:

Check if valuea is equal to valueb.


Example:

if (player == leader group player) then {hint "You are the leader of your group."} else {hint "Someone else is the boss"}

if (name player == "Billy") then {hint "Hello Billy, how are you?"}


Comments:

Does not work with the types Boolean and Array.

i.e. the arguments:

? MyBoolean == [] : hint "This is a test."

and

? MyArray == [] : hint "This is a test."

...will cause errors.

Instead of the first line use:
? MyBoolean : hint "This is a test."

The workaround for the second line is:
? (count MyArray) == 0 : hint "This is a test."