Skip to content
loading...

re: Daily Challenge #153 - Horse Race Gamble VIEW POST

FULL DISCUSSION
 

Ruby

def horses(num)
  if !(num % 1 == 0) || !(num.is_a? Numeric)
    return "undefined"
  elsif num < 3
    return num
  else
    return num*(num-1)*(num-2)
  end
end

puts horses(12)
puts horses(2)
puts horses(11)
puts horses(2.5)
puts horses("a")


code of conduct - report abuse