Is there any method to print multiple ruby variables on the same line? Like in the example below:
env = gets()
name = gets()
puts "Deleting #{name} in #{env}"
I'm trying to put this variables in a system (cmd) also, and I can't set these two variables in the same line... the output is :
Deleting name
in env
Thanks, Vlad
Use
env = gets().chomp
name = gets().chomp
Your code is working exactly as it should. Just remove the newlines from the two strings before printing them.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.