Skip to content

Instantly share code, notes, and snippets.

#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@ariellephan
ariellephan / gist:1710007
Created January 31, 2012 11:28
Ruby 1.2
class Person
attr_accessor :name, :age
def initialize(name, age)
@name = name
@age = age.to_i
end
def inspect
"#@name (#@age)"
end
end
@ariellephan
ariellephan / intefaceabtract
Created February 26, 2015 09:44
loose interface vs abstract in php
interface Mail {
public function sendMail();
public function getFuel();
}
abstract class MyAbstractClass implements Mail {
function myAbstractFunction() {
echo "not abstract";
}