+ 1

How do I use the enter key as my input in ruby.

I tried "\n" but it doesn't work

21st Mar 2019, 8:16 AM
young ochiel
young ochiel - avatar
5 Answers
+ 2
I used "" and it worked
24th Mar 2019, 1:27 PM
young ochiel
young ochiel - avatar
+ 4
This doesn't work because '\n' looks for the characters, \n instead of a new line. You want to use "\n" so it will actually read it as a newline instead of actual characters. Try this if names == "\n" puts "yeah" end //it will help you😊😊😉
21st Mar 2019, 10:08 AM
Max Andal
Max Andal - avatar
+ 3
young ochiel try to use it in code playground
21st Mar 2019, 10:22 AM
Max Andal
Max Andal - avatar
+ 1
Am using on PC
21st Mar 2019, 8:21 AM
young ochiel
young ochiel - avatar
0
Larzy Maxy-! Tried that already. Doesn't work.
21st Mar 2019, 10:09 AM
young ochiel
young ochiel - avatar