Hi, I have the following code snippet:
var z:Array[String] = new Array[String](4);
z(0) = "Dave";
z(1) = "Joe";
z(2) = "Jim";
z.apply(3) = "Roger";
The last line shows a compile-time error: "Missing method arguments are applied in the Array class, follow this method with" _ "if you want to treat it as a partially applied function"
This doesn't make sense to me, as I read that when you use the parentheses associated with yet another variable value, Scala converts the code into a method call called apply for that variable. Therefore, if the following line:
z(2) = "Jim";
converted to
z.apply(2) = "Jim";
Then why line
z.apply(3) = "Roger";
give me a compile time error?
I am new to Scala, so any help would be greatly appreciated!