by 0x5002 · 7y ago · 0 comments
Even if you (somehow) don't know about it, figure something out? Do something "stupid that works" like this:
def floatcheck(x:Float, div:Int): String = (x / div).toString.split("\\.")(1) match {
case "0" => "int"
case _ => "float"
}
(1 until 100).foreach(e => {
if(floatcheck(e,15) == "int") println("fizzbuzz")
else if(floatcheck(e,3) == "int") println("fizz")
else if(floatcheck(e,5) == "int") println("buzz")
else println(e)
})
(I'm guessing this works, or maybe I fall into that category as well ;))No comments yet.