What does it mean to prime a loop? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What does it mean to prime a loop?

I usually come across cases where programmers "prime a loop", and also discovered that it's most common with while loops. So please what it means to "prime a loop". Example: https://code.sololearn.com/csppg96TX9U8/?ref=app

20th Oct 2019, 12:19 PM
A_Coder
A_Coder - avatar
1 Answer
+ 2
The condition at the beginning of a while loop has to make sense even the first time it is tested, before the body of the loop is executed. To prime the loop is to set things up before the loop starts so that the test makes sense
21st Oct 2019, 9:49 AM
STARFIRE
STARFIRE - avatar