Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def test(name)
- names = %w(one two three four)
- names.each do |name|
- puts name
- end
- puts name
- end
- test 'zero'
- #out
- one
- two
- three
- four
- four #this is correct? should be zero
- x = 10
- (1..10).each { |y| print x+y, " "}
- #=> 11 12 13 14 15 16 17 18 19 20
- v = "my value"
- (1..3).each do {|n; v| v = n; puts v }
- # => 1
- # => 2
- # => 3
- puts v #=> "my value"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement