I dont understand part of these codes


#1

hi, I have two codes that are the right answer but something confuses me, here are my codes:
i = 1
while i < 51 do
print i
i += 1
end

and my second code is:

z = 1
until z == 51 do
print z
z += 1
end

ok, so my question is, why do the codes need to contain i < 51 or z == 51 instead of 50?


#2

@tagcoder23872,
In both cases you are print-ing the VALUE's 1 .... 50 (inclusive)

https://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Control_Structures#until

In the while loop, you will continue looping until the condition evaluates to a false

In the until loop, you will continue looping until the condition evaluates to a true


#3

so what i'm getting is the only way to have 1-50 without ".." is to use 51?