Scala Principles in a Nutshell (Part III)

Let’s say that we have the following code in Scala (too similar to Java, btw): def isGoodEnough(inc:Int,x:Int)=x>inc; def increasePosition(inc:Int,x:Int):Int= if (isGoodEnough(inc,x)) return x+inc; else return x; def increasePositionByOne(x: Int) ={ return increasePosition(1,x); } Now we’ll transform that piece of code into something more Scala-ish 😀 First of all, in Scala Read more…