Computer Science, asked by ankitg811282147, 1 year ago

Similarities between for, while and do while loop.
At least 3 similarities

Answers

Answered by AnviGottlieb
22
Their similarity is that both "while" and "for" are used for repeating a loop. Their difference is that we use "for" when we know how many times we need to re-run the loop. When we don't know how many times are needed we use "while".|

Difference: - while loop is condition dependent and does not necessarily need the content to be evaluated - for loop requires content to iterate over Similarity: - both can iterate over a list or structure, but you must define your content to iterate through beneath the while condition whereas for loops define the content index and type at start
Similar questions