Menu

Expressions

 
      In GPC almost anything you write is an expression. The simplest yet most accurate way to define an expression is "anything that has a value". The most basic forms of expressions are constants and variables. When you type "a = 5", you're assigning 5 into a. After this assignment, you'd expect a's value to be 5 as well, so if you wrote "b = a", you'd expect it to behave just as if you wrote "b = 5". In other words, a is an expression with the value of 5 as well.
 
An expression statement consists just of any expression. Basically, expressions are:
 
  • Function calls (get_val())
  • Assignments (=)
  • Comparisons (==, <, ...)
  • Mathematical and Boolean expressions (a + b, a || b, ...)
  • Literal values (like 8 or constants)
  • Variables
 
Examples:
 
y = 10000;
x = y;
b = XB1_LT;
a = (x - y) / b;
y = get_val(PS3_TRIANGLE);
set_val(XB360_A, 100);
(a <= b)