Created
June 14, 2012 16:03
-
-
Save anonymous/2931188 to your computer and use it in GitHub Desktop.
testing activegist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment