Scala is a statically typed language. This means that although variables declared with
var can be replaced with a new value, the type of that variable cannot change over the lifetime of the program. The type of
teamData_All in your script is
test while the type of
teamData_All that you are trying to change it to is
Tuple2[test, test] (or equivalently
(test, test)). These are incompatible types.
If you want to have
teamData_All be growable, you have to specify that sort of behavior upfront when declaring the variable, e.g. by making it a list of type
List[test]. Then you could have one line set
teamData_All = List(test(lol,lel,1,2)) and then have another line set
teamData_All = List(test(lol,lel,1,2),test(kok,kek,3,4)).
The reason why this is necessary for a statically typed language is because if you make references to
teamData_All in multiple places in your code, there is no way for the compiler to statically, i.e. before running your code, know what the type of
teamData_All is at a given point, since you might have changed its type. This makes it impossible for the compiler to make its usual guarantees (e.g. making sure you're only calling methods on things that actually have that method defined).