CHAPTER 4

Expressions

Among the most basic operations one can do with Julian is to use expression to calculate and convert values. Julian supports nearly all the operators you would expect in C-like languages. These include:

  int x = a + b * c; // arithmetic expressions
  bool y = u || v && w; // logical expressions
  float z = (a - b) / e; // nested expression
  int ai[] = new int[2];
  ai[0] = i; // array indexer
  string s = "abc";
  x = s.length; // object accessor
  s = x > 0 ? "these" : "those"; // tertiary operator
  x += x; // arithmetic self-assignment

For incremental operators, however, only the post one is supported. This is to intentionally avoid the confusion associated with when to use pre or post incremental operator.

  int x = 5;
  x++;
  ++x; // syntax error

The operator precedences follow that of C.