Reassignment to Val
Hello everyone,
I'm new to scala so please don't take anything for granted with me :)
Anyway,
I'm getting this error "Reassignment to val"
Let me explain the context : My application is a simple phonebook and a few commands on it
I have a list of Adress, which is empty at first, but you can fill it up eventually with user input entries.
Since lists cannot be modified, the code I'm writing for the "add entry function" goes something like this:
I create a new Adress object from user input
I put it in a List by itself
I create a new List from the Phonebook List where I filter out an identical entry to the one I'm about to put in
I merge the two new Lists
I try to do something like : PhonebookList = newList
this is where I get my error.
Everything up to there seems fine.
I'm guessing this is because i try to modify an existing list,
how can i work around this ?