2 ms·
I would argue that every single programmer with at least the tiniest bit of tenure in the field (or a kid straight out of college who took at least some math cl
by 0x5002 7y ago
I would argue that every single programmer with at least the tiniest bit of tenure in the field (or a kid straight out of college who took at least some math classes) will have run into this at some point in their life.
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 ;))
- deleted 7y ago[deleted]