Reputation: 47
So if i write the following code:
for i in range(1,1): <whatever>
does the loop exit as the i value has already exceeded the upper bound or does something else occur within the loop?
Upvotes: 0
Views: 189
Reputation: 299
It exists out of the loop without executing any loop statements.
Reputation:
Why don't you just try it? The lower bound of a range is inclusive and the upper bound is exclusive (1, 1[ so the loop body doesn't get executed:
list(range(1,1)) []
Upvotes: 1