Jump to content

Game Maker Programming/Expressions

From Wikibooks, open books for an open world

Expressions are comparisons of two things. An example of an expression would be (8 > 6)

Types of Expressions

[edit | edit source]

Expressions can be real number like 6 or 7, 'hexadecimal numbers', strings or more complicated expressions. By default all text is considered a Variables though if the text was in single or double quotes it would be a string. Any number in an expression is considered a real number unless it has a $ sign in front of it. If it had a $ in front of it then it is a 'hexadecimal number'

Operators

[edit | edit source]

An operator is a symbol used for the comparison of two things in an expression. In (8 > 6) the > sign is the operator. There are many different types of operators. For expressions, the following binary operators exist:

  • && means "and". For example "if(pi=3.14 && 3+4=7)"
  • || means "or". For example "if(x=0 || y=0)"
  • ^^ means "xor". example "if(x=32 ^^ y=27)"
  • < means "less than".
  • > means "greater than".
  • <= means "less than or equal to".
  • >= means "greater than or equal to".
  • ! means "Not". For example "if !(Variable=5)"