Expression: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Some wiki formatting)
Line 16: Line 16:
'''Examples:'''
'''Examples:'''


_myVariable
<sqs>
globalVariable
_myVariable
globalVariable
</sqs>


=== Operation ===
=== Operation ===
Line 25: Line 27:
'''Examples:'''
'''Examples:'''


5 * 6
<sqs>
a % 2
5 * 6
b * c
a % 2
b * c
</sqs>


=== Scripting Command ===
=== Scripting Command ===
Line 35: Line 39:
'''Examples:'''
'''Examples:'''


[[count]] myArray
<sqs>
[[position]] unit1
count myArray
position unit1
</sqs>


=== Control Structure ===
=== Control Structure ===
Line 44: Line 50:
'''Examples:'''
'''Examples:'''


  if (myCondition) then {myValueA} else {myValueB}
<sqs>
; returns myValueA or myValueB
=> returns myValueA or myValueB
  if (myCondition) then { myValueA } else { myValueB }
</sqs>
 


[[Category: Syntax]]
[[Category: Syntax]]

Revision as of 12:16, 22 July 2022

An expression is a piece of code that returns a value.

Types of Expressions

An expression can be:

Variable

An expression can be a simple variable (identifier):

Examples:

_myVariable globalVariable

Operation

An expression can be an operation including its operands.

Examples:

5 * 6 a % 2 b * c

Scripting Command

An expression can be a scripting command returning a value including its arguments.

Examples:

count myArray position unit1

Control Structure

An expression can be a control structure returning a value.

Examples:

; returns myValueA or myValueB if (myCondition) then { myValueA } else { myValueB }