[kde-edu]: Recursion in KTurtle?

Matthias Messmer matthias at familie-messmer.de
Fri Oct 5 18:11:48 CEST 2007


Hi Ralf!

Ralf Gesellensetter wrote:
> a colleague asks me if it isn't possible to use recursive procedures in 
> kturtle - she failed implementing Koch-curves or fractals.
> 
> Any clue?

Try this:

--8<-----------------------------------

learn poweroftwo x [
  if x == 0 [
   return 1
  ]
  else [
   return 2 * poweroftwo x-1
  ]
]

clear
print poweroftwo 1



More information about the kde-edu mailing list