Logo - Recursive Procedures


Advertisements


In a recursive procedure, there will be a recurrence call of the procedure within the procedure. Let us consider the following code −

to spiral_recur :n
   if :n < 1 [stop]
   fd :n
   rt 20
   spiral_recur 0.95 * :n
end

The procedure spiral_recur has been called from the procedure body itself. The following screenshot shows the execution and output of the code.

Recursive Procedures

Advertisements
E-Books Store