Saturday, January 5, 2013

output: puts, print, p


puts

array = %w{quick brown fox}
array.collect {|x| puts x.capitalize}

# => 
# Quick
# Brown
# Fox

print

array = %w{quick brown fox}
array.collect {|x| print x.capitalize}

# => QuickBrownFox

p

array = %w{quick brown fox}
array.collect {|x| puts x.capitalize}

# =>
# "Quick"
# "Brown"
# "Fox"

No comments:

Post a Comment