News for hackers. Stuff that matters.
Re:Why your first Rust FizzBuzz implementation may not work by Jweb_Guru on Monday October 13, 2014 @03:38AM (#8447831)
You can write Ruby in this fashion as well.

  def fizzbuzz x
    case [x % 3 == 0, x % 5 == 0]
      when [true, false] then puts "fizz"
      when [false, true] then puts "buzz"
      when [true, true] then puts "fizzbuzz"
      else puts x
    end
  end
The one and only time I was asked FizzBuzz in an interview, I wrote it this way, so it's not all that contrived (in my opinion, anyway!)

There are no comments on this comment yet.