This is the end of Part One, which was hopefully enough to get you started. If you've grasped the main concepts you are good position to attack Part Two, which covers the E language in more detail.
This is probably a good time to look at the different parts of one of the examples from the previous sections, since we've now used quite a bit of E.
The following examination uses the WHILE
loop example.
Just to make things easier to follow, each line has been numbered (don't try to compile it with the line numbers on!).
1. PROC main() 2. DEF x,y 3. x:=1 4. y:=2 5. WHILE (x<10) AND (y<10) 6. WriteF('x is \d and y is \d\n', x, y) 7. x:=x+2 8. y:=y+2 9. ENDWHILE 10. ENDPROC
Hopefully, you should be able to recognise all the features listed in the table below. If you don't then you might need to go back over the previous chapters, or find a much better programming guide than this!
Line(s) Observation --------------------------------------------------------- 1-10 The procedure definition. 1 The declaration of the proceduremain
, with no parameters. 2 The declaration of local variablesx
andy
. 3, 4 Initialisation ofx
andy
using assignment statements. 5-9 TheWHILE
loop. 5 The loop check for theWHILE
loop using the logical operatorAND
, the comparison operator `<', and parentheses to group the expression. 6 The call to the (built-in) procedureWriteF
using parameters. Notice the string, the place holders for numbers, `\d', and the linefeed, `\n'. 7, 8 Assignments tox
andy
, adding two to their values. 9 The marker for the end of theWHILE
loop. 10 The marker for the end of the procedure.
Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.