Quote:
Originally Posted by Konstantinos
Have you tried?
pawn Код:
new payment ; if( weight > 9 && weight <= 50 ) payment = 100; else if( weight > 50 && weight <= 100 ) payment = 150; else if( weight > 100 && weight <= 150 ) payment = 200; else if( weight > 150 && weight <= 200 ) payment = 250; else payment = 0;
// -- OR --
new payment ; switch( weight ) { case 10 .. 50: payment = 100; case 51 .. 100: payment = 150; case 101 .. 150: payment = 200; case 151 .. 200: payment = 250; default: payment = 0; }
|
I know how to do it that way. I've never used the ternary operator with nesting.. So I thought i'd try it.