Wat is the difference? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Wat is the difference?

//all the parenthesis have conditions... for(){} //some code ------------------ for() //some code ------------------ for(){ //some code }

27th Oct 2019, 3:48 AM
Sanzid Sadman
Sanzid Sadman - avatar
1 Answer
0
1. It's an empty loop, there's no code within loop body. "some code" may execute, but there won't be any repetition as "some code" is outside loop scope. 2. "some code" may execute but notice that - only the first line is executed when "some code" consists of multiple lines. The rest of the lines following the first in "some code" may execute but without repetition as they are outside loop scope. 3. It's a regular loop with "some code" within loop body. The whole "some code" may execute except for syntax or logic error(s).
27th Oct 2019, 4:08 AM
Ipang