Damn you waffle!

I was gonna sound clever suggesting a recursive function.
Could you please explain what you mean by
Quote: "
In C++, each time a function is called, the function
gets a new stack space with new variables ....
In DBC, all variables are STATIC.
But, as long as you know this, this will work fine.
"
@ latch
Here is the only program I've made with good recursive functions, it should help you understand how to use them. If you already understand them have a look anyway, it's cool lol.
`*** The Towers of Hanoi Problem ***
`I will use binary system to store rings on poles (1=small ring, 2=medium, 4=large)
DIM Pole(3)
source = 1 : `set start pole
`setup
hide mouse
sync on
DO
`set up new puzzle
repeat : destination= rnd(2)+1 : until destination <> source : `get end pole
repeat : temporary_store= rnd(2)+1 : until temporary_store <> source and temporary_store <> destination
Pole(source) = 7 : Pole(destination) = 0 : Pole(temporary_store) = 0 : `initiate poles
display() : `display the initial puzzle
print "New destination: " ; destination : sync : wait 1000 : `begin puzzle message
source = Transfer(3, source, destination, temporary_store) : `complete the puzzle and return new source
LOOP
`Transfer
FUNCTION Transfer(N, source, destination, temporary_store)
`Problem Fix Variables
S = source
D = destination
T = temporary_store
If N = 1
Move(S, D)
Else
Transfer(N-1, S, T, D)
Move(S, D)
Transfer(N-1, T, D, S)
Endif
ENDFUNCTION destination
`Move
FUNCTION Move(source, destination)
`which ring is to be moved?
Select Pole(source)
Case 1 : ring = 1 : Endcase
Case 2 : ring = 2 : Endcase
Case 3 : ring = 1 : Endcase
Case 4 : ring = 4 : Endcase
Case 5 : ring = 1 : Endcase
Case 6 : ring = 2 : Endcase
Case 7 : ring = 1 : Endcase
Endselect
`Take ring from source and add to destination
Pole(source) = Pole(source) - ring
Pole(destination) = Pole(destination) + ring
`Update display
Display()
ENDFUNCTION
`Display
FUNCTION Display()
cls
For x = 1 to 3
`draw poles
ink rgb(120,40,0),0
Line 100+(100*x), 100, 100+(100*x), 200
`disintegrate pole variables
ink rgb(255,200,0),0
pole = Pole(x) : `store current pole rings value
rings = 0
`big ring?
if pole - 4 >=0
inc rings
box 100+(100*x)-40, 183-((rings-1)*20), 100+(100*x)+40, 200-((rings-1)*20)
pole = pole - 4
endif
`medium ring?
if pole - 2 >=0
inc rings
box 100+(100*x)-30, 183-((rings-1)*20), 100+(100*x)+30, 200-((rings-1)*20)
pole = pole - 2
endif
`small ring?
if pole - 1 >=0
inc rings
box 100+(100*x)-20, 183-((rings-1)*20), 100+(100*x)+20, 200-((rings-1)*20)
pole = pole - 1
endif
Next x
sync
wait 1000
ENDFUNCTION
I make music and art. Here is a sample of my art: done in Paint! It's all I have
