Progate learning notes
gets.chomp
puts "Please enter your name"
#Takes input from the console and assigns it to the variable name
name = gets.chomp
puts "Hello,#{name}Mr."
Console ↓
Please enter your name#Waiting for input
If you enter "Taro",
Hi, Taro
gets.chomp
is received as a character string, so if you want to receive it numerically,
Use count = gets.chomp.to_i
.
reference Progate
Recommended Posts