You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A for statement no checks whether the counter x is between startand end. this is handy if you dont really know where you're counting up or down (we dont know if step is positive or negative).
FOR x := start TO end BY step DO
...
END_FOR
so we do a check like: x >= start && x <= end || x >= end && x <= start to accomodate for both situations (start < end -> counting up or start > end -> counting down)
if we know that we count up (or down) at compile time (e.g. if no step is provided, or it is a literal), we can skip several of the checks. when counting up, we only need to check against the x <= end ...
The text was updated successfully, but these errors were encountered:
A for statement no checks whether the counter
x
is betweenstart
andend
. this is handy if you dont really know where you're counting up or down (we dont know if step is positive or negative).so we do a check like:
x >= start && x <= end || x >= end && x <= start
to accomodate for both situations (start < end
-> counting up orstart > end
-> counting down)if we know that we count up (or down) at compile time (e.g. if no step is provided, or it is a literal), we can skip several of the checks. when counting up, we only need to check against the
x <= end
...The text was updated successfully, but these errors were encountered: