what is the difference between iteration and recursion method in algorithms?
Iteriation loops over data with similar names like 3 variable var0 var1 var2 loop it use the loops counter to iterate over each variable for(var i=0; i<2; i++){trace(var+i);}
ok
recursion tells a function to repeat its self continously //intialize func0 (); function func0( param0=null):void{ param0(); //calls its self over and over again after being intialzed in the constructor part of a class}
sudo code modify for you language
thats mostly Flash AS3.0
in the dictionary it says that both are about repeating procedure so what's the difference? sorry I didn't get your last two msgs
iteriation has an end
recursion has no end untill you return the function or maybe a break statement
you could end the program to end recursion too...iteriation is going to stop when it increments 3 tims
if you looped over an array you could make the counter say for(var i=0; i<arr0.length-1; i++){trace(arr0[i])}
you could get rid of the minus 1 too ....just play around with this its pretty important when writing programs....you can also use timers to repeat functions on a timed interval...kinda useful if you need to wait for another class to process data before calling a function but event listeners are even more useful for that
thanks @calmchessplayer
Join our real-time social learning platform and learn together with your friends!