Welcome! Log In Create A New Profile

Advanced

Re: I failed to write : Good-looking assignment to private Array

September 04, 2011 11:43AM
How about...

Language: Scala
class GoodLookingAssign { private var theScore = Array(0.0, 0.0, 0.0);   def apply(i:Int): Double = theScore(i)   def update(i:Int, v:Double) = { theScore(i) = checkValid(v) }   def checkValid(x:Double): Double = { var out = x if (out < 0) { out = 0} out } }   object ApplyGoodLooking {   def main(args: Array[String]) { val g = new GoodLookingAssign() println("g.score(0) = "+g(0))   g(0) = 4.4 println("g.score(0) = "+g(0)) }   }

__________________________________________________________
val signature:Option[String] = None



Edited 1 time(s). Last edit at 09/04/2011 11:45AM by Landei.
Subject Author Views Posted

I failed to write : Good-looking assignment to private Array

Heepo 713 September 03, 2011 09:08AM

Re: I failed to write : Good-looking assignment to private Array

Landei 371 September 04, 2011 11:43AM

Re: I failed to write : Good-looking assignment to private Array

Heepo 297 September 04, 2011 06:14PM

Re: I failed to write : Good-looking assignment to private Array

Landei 321 September 04, 2011 10:11PM

Re: I failed to write : Good-looking assignment to private Array

Heepo 279 September 05, 2011 08:35AM

Re: I failed to write : Good-looking assignment to private Array

Antoras 296 September 10, 2011 10:11AM

Re: I failed to write : Good-looking assignment to private Array

Landei 419 September 10, 2011 12:55PM