+ 1

Why B and C are diffrent in this code

Why B and C are diffrent from A in this code? https://code.sololearn.com/WI4awQp2hJAM/?ref=app

28th May 2020, 12:55 PM
LordOfBrightnes
1 Resposta
+ 3
The loop first prints A and checks if the counter is 5. If not, then it continues and prints B. So it goes four times before finally meeting the === 5 criterium, when, after printing A, it returns to the main code. C is outside the loop so never gets executed, as the function returns after five executions of the loop.
28th May 2020, 1:00 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar