In this HackerRank Ruby Control Structures - Until problem solution, This challenge has a beautiful one-liner answer. "A hacker practices on HackerRank until getting to a rating of O(1) read as (Oh-one)"

Call the method coder. practice until coder.oh_one? becomes true.

Use the until control structure. until is the logical equivalent of while not.

while not <condition>

    <code>

end

or


until <condition>

    <code>

end

or the beautiful one-liner

<code> until <condition>

HackerRank Ruby Control Structures - Until problem solution


Problem solution.

coder.practice until coder.oh_one?


Second solution.

# Enter your code here. Read input from STDIN. Print output to STDOUT

while not coder.on_one?
    coder.practice
end