Expression: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Some wiki formatting)
m (Some wiki formatting)
 
Line 1: Line 1:
{{TOC|side}}
An '''expression''' is a piece of code that returns a value.
An '''expression''' is a piece of code that returns a value.


== Types of Expressions ==
 
== Expression Types ==


An expression can be:
An expression can be:
Line 52: Line 54:
<sqs>
<sqs>
; returns myValueA or myValueB
; returns myValueA or myValueB
if (myCondition) then { myValueA } else { myValueB }
if (myCondition) then { myValueA } else { myValueB }
</sqs>
</sqs>




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

Latest revision as of 16:32, 10 January 2023

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


Expression Types

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 }