When you need the loop to go on and on until the conditional is false, it’s convenient to use a while<\/strong><\/em> loop. When you have a predefined range that works as the conditional in a program you need to use for<\/strong><\/em> loops, finally when you need to call a function inside the same function it’s called a recursion<\/strong><\/em>, it makes it simpler but not always works as efficiently, each of these have different purposes, it’s a matter of knowing which suits the logic of the program best.<\/p>\n Here’s an example of each:<\/p>\n <\/a><\/p>\n <\/a><\/p>\n <\/a><\/p>\n <\/a> <\/p>\n","protected":false},"excerpt":{"rendered":" When you need the loop to go on and on until the conditional is false, it’s convenient to use a while loop. When you have a predefined range that works as the conditional in a program you need to use for loops, finally when you need to call a function inside the same function it’s […] Continue reading