15. Looping with 'Until'


Hey everyone! Can someone please explain to me why does the == comparator have to equal to 51 in order to include 50 when printing? Is that how it always works? How can I make it so that it includes 50?


x = 1
until x == 51 do
    print x
    x += 1


This excludes the value 51 from the loop. It is the exit condition. Consider,

x = 0
until x > 50 do
    x += 1
    print x

Using the inequality lets us use the literal that makes the most sense.


That makes so much more sense! Thank you!!!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.