a = gets.chomp.to_i # ^^^^^
You convert the entered string to a number ...
if (a == "monday")
... and then compare the number with the string .
Ruby has strong typing . These are different data types, and the equality operator for strings and numbers on different types always returns false . Your condition will simply never be fulfilled.
Track which type has each value in your program and make sure that there is what you expect.
You may be interested in why there was no NameError , if in the end nothing came of the variable. Where did nil come from. There is a very significant case, demonstrating where this behavior comes from:
x = x # ...когда `x` не определён # => nil
Ruby syntax is designed in such a way that local variables in the code can be seen in advance. The interpreter initializes all local variables of a piece of code in nil prior to its execution.
It is in this line that the interpreter sees that x local variable and assignment occurs in it. So when the performance starts, there is already nil .