Google

Go to the first, previous, next, last section, table of contents.


various expressions

Major elements to construct expressions are the following:

  • addition, subtraction, multiplication, division, exponentiation
    The exponentiation is denoted by `^'. (This differs from C language.) Division denoted by `/' is used to operate in a field, for example, 2/3 results in a rational number 2/3. For integer division and polynomial division, both including remainder operation, built-in functions are provided.
    x+1  A^2*B*afo X/3 
    
  • programming variables with indices
    An element of a vector, a matrix or a list can be referred to by indexing. Note that the indices begin with number 0. When the referred element is again a vector, a matrix or a list, repeated indexing is also effective.
    V[0] M[1][2]
    
  • comparison operation
    There are comparison operations `==' for equivalence, `!=' for non-equivalence, `>', `<',`>=', and `<=' for larger or smaller. The results of these operations are either value 1 for the truth, or 0 for the false.
  • logical expression
    There are two binary logical operations `&&' for logical `conjunction'(and), `||' for logical `disjunction'(or), and one unary logical operation `!' for logical `negation'(not). The results of these operations are either value 1 for the truth, and 0 for the false.
  • assignment
    Value assignment of a program variable is usually done by `='. There are special assignments combined with arithmetic operations. (`+=', `-=', `*=', `/=', `^=')
    A = 2  A *= 3 (the same as A = A*3; The other combination are alike.)
    
  • function call
    A function call is also an expression.
  • `++', `--'
    These operators are attached to or before a program variable, and denote special operations and values.
    A++  the expression value is the previous value of A, and A = A+1
    A--  the expression value is the previous value of A, and A = A-1
    ++A  A = A+1, and the expression value is the value after increment of A
    --A  A = A-1, and the expression value is the value after decrement of A
    


Go to the first, previous, next, last section, table of contents.