Always 100
#4

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.
Reply


Messages In This Thread
Always 100 - by thefatshizms - 23.08.2013, 15:51
Re: Always 100 - by thefatshizms - 23.08.2013, 16:29
Re: Always 100 - by Konstantinos - 23.08.2013, 16:43
Re: Always 100 - by thefatshizms - 23.08.2013, 16:46
Re: Always 100 - by thefatshizms - 23.08.2013, 16:49
Re: Always 100 - by Konstantinos - 23.08.2013, 16:50
Re: Always 100 - by thefatshizms - 23.08.2013, 16:54

Forum Jump:


Users browsing this thread: 1 Guest(s)