« Return to Thread: Reassignment to Val
Well,
I declared the list as a "var" in my main
However it is a function parameter where I have the error
What do I have to do to make sure it stays a "var" and not a "val" ?
(If that is what I have to do, maybe I'm misunderstanding)
--
Randall Schulz wrote:
>
> On Monday July 6 2009, Joob wrote:
>> Hello everyone,
>>
>> I'm new to scala so please don't take anything for granted with me :)
>
> Well, you see, computers are these electronical machines that we use to
> make like difficult for others...
>
>
>> Anyway,
>> I'm getting this error "Reassignment to val"
>
> A "val" is an "immutable" record of a value. By immutable we mean it
> cannot be reassigned. There are lots of positive virtues to defining
> programs in terms of immutable data, but it's sometimes challenging to
> do so. Unlike Haskell, which is considered a "pure" functional language
> that strictly forbids such "side-effects" and "mutable state," Scala
> doesn't force you to use immutable data. When you feel the need to be
> able to reassign the value in a field or local variable (or function /
> method parameter), you can use a "var" instead of a val.
>
>
>> ...
>>
>> Can anyone help me ?
>
> Anything could happen...
>
>
> Randall Schulz
>
>
View this message in context: http://www.nabble.com/Reassignment-to-Val-tp24363871p24364035.html
Sent from the Scala - User mailing list archive at Nabble.com.
« Return to Thread: Reassignment to Val
| Free embeddable forum powered by Nabble | Forum Help |