Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.


10.1 Turning an Expression into a Statement

The VOID operator converts an expression to a statement. It does this by evaluating the expression and then throwing the result away. This may not seem very useful, but in fact we've done it a lot already. We didn't use VOID explicitly because E does this automatically if it finds an expression where it was expecting a statement (normally when it is on a line by itself). Some of the expressions we've turned into statements were the procedure calls (to WriteF and fred) and the use of ++. Remember that all procedure calls denote values because they're really functions that return zero by default (see 7.1 Functions).

For example, the following code fragments are equivalent:

  VOID WriteF('Hello world\n')
  VOID x++

  WriteF('Hello world\n')
  x++

Since E automatically uses VOID it's a bit of a waste of time writing it in, although there may be occasions when you would want to use it to make this voiding process more explicit (to the reader). The important thing is the fact that expressions can validly be used as statements in E.


Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.