Quote:
Originally Posted by Korvacs
Correct.
If you want to do more things you should probably use a switch, you can handle all possibilities and use default: for everything else.
|
Example of a switch for op...
Code:
[COLOR="Red"]String Switch..[/COLOR]
string Jesus = "";
switch (Jesus)
{
case "God":
{
break;
}
case "Mary":
{
break;
}
case "Empty Project":
{
break;
}
default:
{
break;
}
}
or...
Code:
[COLOR="Magenta"]Byte Switch[/COLOR]
Byte Jesus = 0;
switch (Jesus)
{
case 1:
{
break;
}
case 2:
{
break;
}
case 3:
{
break;
}
default:
{
break;
}
}
default is basically if its not there it will go to there.. its like the
else statement..
ofcourse you can use switches for various things..sometimes an if-else statement is much better than switches...