Deciding repetition

--Originally published at Just A Turtle Coding.

How to know which type of repetition to use… It’s a great question for programmers. 

One factor to take into account is the space you are allowed to use, how many bytes or megabytes or gigabytes are you allowed to use? 

Another factor to take into account is the length of the program and if you could make it shorter. A factorial can be made simpler if done with a repetition algorithm rather than using nested ifs or nested loops

One last factor to take into account is how simple it is for humans to read. If you just nest loops then it might be more complicated than if using a for loop.