Switch not working when calling string.split
string test = "test string";
if (test.split(" ")[0] == "test") {
print("This works \n");
}
var first = test.split(" ")[0];
switch (first) {
case "test":
print("So does this \n");
break;
default:
break;
}
var split = test.split(" ");
switch(split[0]) {
case "test":
print("And this \n");
break;
default:
break;
}
switch (test.split(" ")[0]) {
case "test":
print("But this doesn't?");
break;
default:
break;
}
Edited by Allie