Skip to content

Instantly share code, notes, and snippets.

# must be baller and either furnished or rent cheaper than 2100
def rent?(furnished, rent, baller)
if baller && furnished || rent < 2100
return true
else
return false
end
end
###
@shinobcrc
shinobcrc / fizzbuzz.rb
Last active June 22, 2016 02:59
fizzbuzz
def fizzbuzz(max)
(1..max).each do |i|
if i % 15 == 0
puts "FizzBuzz"
elsif i % 5 == 0
puts "Buzz"
elsif i % 3 == 0
puts "Fizz"
else
puts i
@shinobcrc
shinobcrc / max.rb
Last active June 22, 2016 02:59 — forked from davidvandusen/max.rb
# Find the maximum
def maximum(array)
max = array[0]
array.each do |x|
if max < x
max = x
end
end
max
[1] pry(main)> def say_hi(name)
[1] pry(main)* "Hi #{name}"
[1] pry(main)* end
=> :say_hi
[2] pry(main)> say_hi("Shino")
=> "Hi Shino"
[3] pry(main)> my_number = 23
=> 23
[4] pry(main)> my_array = [1,25,61,2]
=> [1, 25, 61, 2]