summaryrefslogtreecommitdiffhomepage
path: root/ruby.html.markdown
diff options
context:
space:
mode:
Diffstat (limited to 'ruby.html.markdown')
-rw-r--r--ruby.html.markdown6
1 files changed, 6 insertions, 0 deletions
diff --git a/ruby.html.markdown b/ruby.html.markdown
index 7fe34336..51c4b9d8 100644
--- a/ruby.html.markdown
+++ b/ruby.html.markdown
@@ -261,6 +261,12 @@ hash.each do |key, value|
puts "#{key} is #{value}"
end
+# If you still need and index you can use "each_with_index" and define an index
+# variable
+array.each_with_index do |element, index|
+ pust "#{element} is number #{index} in the array"
+end
+
counter = 1
while counter <= 5 do
puts "iteration #{counter}"