Skip to content

Instantly share code, notes, and snippets.

@roneesh
roneesh / Recursion.rb
Created December 4, 2012 07:32
Examples of recursion
#RECURSION EXERCISES
# BASIC RECURSION FACTORIAL FUNCTION
def factorial(n)
#termination case
if n < 0
return puts "You can't factorial a negative number!"
end
@roneesh
roneesh / gist:3988972
Created October 31, 2012 18:37 — forked from JeffCohen/gist:3986887
Week 5 Ruby Challenge
class Person
attr_accessor :name
attr_accessor :hometown
def bio
# Add code here
end
end