diff options
Diffstat (limited to 'samples/00_intermediate_ruby_primer/app/05_looping.txt')
| -rw-r--r-- | samples/00_intermediate_ruby_primer/app/05_looping.txt | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/samples/00_intermediate_ruby_primer/app/05_looping.txt b/samples/00_intermediate_ruby_primer/app/05_looping.txt deleted file mode 100644 index fafdcfc..0000000 --- a/samples/00_intermediate_ruby_primer/app/05_looping.txt +++ /dev/null @@ -1,61 +0,0 @@ -# ==================================================================================== -# Looping -# ==================================================================================== -# -# Looping looks a whole lot different than other languages. -# But it's pretty awesome when you get used to it. - -puts '' -puts '' -puts '================================' -puts '' - -# ==================================================================================== -# times -# ==================================================================================== - - -puts "times block:" -3.times do |i| - puts i -end -puts '' - - -# ==================================================================================== -# ranges -# ==================================================================================== - -puts "range block exclusive:" -(0...3).each do |i| - puts i -end -puts '' - -puts "range block inclusive:" -(0..3).each do |i| - puts i -end -puts '' - -# ==================================================================================== -# Enumerables -# ==================================================================================== - -puts 'array each' -colors = ["red", "blue", "yellow"] -colors.each do |color| - puts color -end -puts '' - -puts 'array each_with_index' -colors = ["red", "blue", "yellow"] -colors.each_with_index do |color, i| - puts "#{color} at index #{i}" -end - -puts '' -puts '================================' -puts '' -puts '' |
