### 5.2 Conditional Statements ¶

Syntax for conditional statement is:

    if assertion block { { elseif  assertion block } ... else block } end

Example:

    if x < 0
      print "x is negative."
    elseif x > 0
      print "x is positive."
    else
      print "x is null."
    end

Using the `stop` command within a conditional statement allows one to abort the execution of a script when some condition is met.

#### Boolean operators ¶

`not a`

  Negation of assertion a.

`a and b`

  Disjunction of assertions a and b.

`a or b`

  Conjunction of assertions a and b.

#### Boolean constants ¶

`true`
`false`

#### Comparison operators ¶

`a == b`

  Checks whether objects a and b are equal, i.e. have the same internal representation. Objects may be numbers, strings, points, vectors, sets, lines, circles or conics.

`a != b`

  Negation of the former.

`x < y`
`x <= y`
`x > y`
`x >= y`

  Comparison of numbers x and y.

#### Set assertions ¶

`A in s`

  Checks whether point A belongs to set s.

`empty(s)`

  Checks for emptiness of set s.

#### Geometric assertions ¶

`A on s`

  Checks whether point A is on object s, where s may be a set (considered as an open path), a line, a circle or a conic.

`collinear(A, B, C)`

  Checks whether points A, B and C are collinear.

`collinear(u, v)`

  Checks whether vectors u and v are collinear, i.e. have same or opposite directions.

`parallel(l, l')`
`perpendicular(l, l')`

  Direction comparison of lines l and l'.

`ellipse(c)`
`hyperbola(c)`
`parabola(c)`

  Type checking of conic c.

`isosceles(A, B, C)`
`equilateral(A, B, C)`
`right(A, B, C)`

  Type checking of triangle ABC.

`parallelogram(A, B, C, D)`
`rectangle(A, B, C, D)`
`square(A, B, C, D)`

  Type checking of quadrilateral ABCD.

#### Output format flags ¶

`eps`

  True with `eukleides`.

`pstricks`

  True with `euktopst`.

`display`

  True within GUI.

#### Ternary operator ¶

`assertion ? x | y`

  Number x if assertion is true, number y otherwise.