ruby exercise memo I (puts)


Let's actually write the code of ruby. This time is the first.

Theme 1

with ruby ​​hello \ _world. (Issues in

The code I wrote this time

# 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.

Theme 2

Hello. For the received string. (Issues at the link above)

The code I wrote this time

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

Reference material

Chart type ruby-I (puts)

Recommended Posts

ruby exercise memo I (puts)
Personal memo Progate Ruby I (2)
Ruby memo
I started Ruby
ruby Exercise Memo II (variable and method)
[wip] Ruby memo
Ruby study notes (puts)
Ruby study memo (conditional branching)
[Self-use memo] (Ruby) class, class instance, instance
Ruby study memo (recursive function)
I tried Jets (ruby serverless)
I don't understand Ruby 3 Ractor
[Ruby ~ Iterative processing ~] Study memo 4
ruby Exercise Memo III (if, case, array, each by leap year)
[Ruby 3.0] A memo that I added a type definition to a library I wrote
Ruby design pattern template method pattern memo
Ruby: I made a FizzBuzz program!
Ruby on Rails 6.0 environment construction memo
String output method memo in Ruby
<First post> I started studying Ruby
[Note] [Beginner] Ruby writing memo (refactoring) 1
I tried using Java memo LocalDate