Skip to content

Instantly share code, notes, and snippets.

@onpaws
Forked from anonymous/ruby_fiddle.rb
Created June 14, 2012 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onpaws/2931189 to your computer and use it in GitHub Desktop.
Save onpaws/2931189 to your computer and use it in GitHub Desktop.
testing activegist
# Your Assignment:
# (easy) First, print the numbers 1 to 10 in the console
puts "1. ---------------"
(1..10).each do |i|
puts i
end
# (medium) Second, Write a method that takes an array [-4,-76, 64, 200, -2, 644] and only prints positive integers
puts "2. ---------------"
def pos(arr)
arr.each do |i|
if (i > 0 && (i.kind_of? Integer))
puts i
end
end
end
pos([-2,-1,0,1,2,3,4.0])
# You write a question showing off a piece of ruby YOU love.
# How do you print the time right now?
puts "3. ---------------"
Time.now
@onpaws
Copy link
Author

onpaws commented Jun 14, 2012

my solutions to the ruby quiz at rubyfiddle.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment