Let's actually write the code of ruby. This time is the first.
with ruby hello \ _world. (Issues in https://qiita.com/daddygongon/items/1b0f0ff3fb9d60418289)
# require
require 'pp'
# start here output
puts 'hello world'
p 'hello world'
pp 'hello world'
print 'hello world'
printf 'hello world'
There is no particular explanation for code. If you write it like that, it will be output. For explanations of various methods, see the links I posted earlier.
Hello. For the received string. (Issues at the link above)
puts "Hello #{ARGV[0]}."
#puts "Hello " + ARGV[0] + "."
#print "Hello #{ARGV[0]}.\n"
#print "Hello " + ARGV[0] + ".\n"
#printf("Hello %s.\n", ARGV[0])
Just rewrite the previous code a bit. (Use ARGV [0]
)
Then,
> ruby hello_name.rb sonic
Hello sonic.
Will be like this
Recommended Posts