Re: [CODE] Exp code and formula

From: George (greerga@DRAGON.HAM.MUOHIO.EDU)
Date: 11/19/97


On Wed, 19 Nov 1997, Leonardo Herrera L. wrote:

>George wrote:
>> On Tue, 18 Nov 1997, Chuck Reed wrote:
>> >if (GET_LEVEL(ch) >= 0 && GET_LEVEL(ch) < 10)
>> >   mod = 1;
>
>[similar stuff snipped]
>
>> >if (GET_LEVEL(ch) >= 50 && GET_LEVEL(ch) < 60)
>> >   mod = 25;
>> >else
>> >   mod = 30;
>>
>> Notice that your 'mod' will always be 25 or 30.
>
>I don't see why.

May God help us all...

Seriously, if..else if is covered in any C book, please go buy one.

The short of it is that NO MATTER WHAT, one of the last two statements will
be executed, overwriting the value of 'mod'.

Think about if mod == 30, then if mod == 55 and you'll see.

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST