I have a quick question that I cant find an answer to:
How come I can say (importing the system namespace of course):
if(someString.StartsWith("bla")){
do something...
}
but I can’t say:
switch(someString.StartsWith){
case "bla":
do this...
case "idk":
do that...
}
Thanks.
someString.StartsWith("whatever") returns a bool, not a string! You can't use it like that. If you're trying to get the first 3 characters of the string, you would use
switch(someString.SubString(0, 3))
{
case "bla":
do some things...
case "idk":
do something else...
}
This is compatible with using a switch in this way, because it returns a string which can then be compared in your cases!