mardi 4 mai 2021

how to remove input form consol in ruby

#input :

puts "hello what is your name " name = gets.chop

puts "Hello #{name} nice to meet you!"

#output:

hello what is your name rat Hello rat nice to meet you!

when i execute my script it shows :hello what is your name then i wrote name :ex rat when i wrote >>rat.it directly prints the output : Hello rat nice to meet you! . but i want to clear first name =rat >>and then print output. so how can i ?

Aucun commentaire:

Enregistrer un commentaire