08.08.2013, 20:40
pawn Код:
if(a == 7 || a == 8)
//equals to:
switch (a)
{
case 7, 8: {
///Something
}
}
pawn Код:
if(a == 7 || a == 31 || a == 98 || a == 104 || a == 1009)
{
//stuff
}
//Equals to
switch(a) {
case 7, 31, 98, 104, 1009: {
//Stuff
}
}
pawn Код:
if(a >= 1 && a <= 99)
{
//Something
}
else if(a >= 100 && a <= 199)
{
//Something
}
else if(a >= 200 && a <= 299)
{
//Something
}
else
{
//Something
}
pawn Код:
switch (a)
{
case 1...99:
{
}
case 100...199:
{
}
case 200...299:
{
}
default: //Default equals to 'else' - when no other option is available, default is called.
{
}
}