gets
Reads a line from the user.
Syntax
gets.chomp
Description
Gets a line of text from the keyboard. Add .chomp to remove the trailing newline.
Example
Loading editor…
This language is for reference/learning only — copy the code and try it in your own environment.
Expected output
(depending on the entered name) Hello Alex
When to use?
Getting input in console programs.