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


16 Recursion

A recursive function is very much like a function which uses a loop. Basically, a recursive function calls itself (usually after some manipulation of data) rather than iterating a bit of code using a loop. There are also recursive types, which are objects with elements which have the object type (in E these would be pointers to objects). We've already seen a recursive type: linked lists, where each element in the list contains a pointer to the next element (see 9.6 Linked Lists).

Recursive definitions are normally much more understandable than an equivalent iterative definition, and it's usually easier to use recursive functions to manipulate this data from a recursive type. However, recursion is by no means a simple topic. Read on at your own peril!


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