Hi everyone, does anyone know about irb and how come when you write gets.chomp the cursor goes all the way to the left of the screen and whatever you write in there does not get it Replace this line with your code.
gets.chomp reads from stdin and returns the entered text
The cursor goes all the way to the left because that's what happens when you press enter, it starts a new line, this isn't something that gets.chomp does
→ irb irb(main):001:0> gets.chomp hello => "hello"
As you see, I entered hello and upon pressing enter gets.chomp returned the text I wrote, same as any other function:
→ irb irb(main):001:0> 4.to_s => "4"
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.