stepping back to chapter 7 for a bit
This commit is contained in:
parent
0bca534c3e
commit
66fa87808c
15
cookbook/007/intro.rb
Normal file
15
cookbook/007/intro.rb
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[1, 2, 3].each { |i| puts i }
|
||||||
|
|
||||||
|
[1, 2, 3].each do |i|
|
||||||
|
if i % 2 == 0
|
||||||
|
puts "#{i} is even."
|
||||||
|
else
|
||||||
|
puts "#{i} is odd."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
1.upto 3 do |x|
|
||||||
|
puts x
|
||||||
|
end
|
||||||
|
|
||||||
|
1.upto(3) { |x| puts x }
|
Loading…
Reference in New Issue
Block a user