Re: [Circle] != ==

From: Alvoria MUD (mudguy@conan.ids.net)
Date: 11/18/96


On Mon, 18 Nov 1996, Bruce, Ray, Phil wrote:
> if (GET_POS(i) != POS_FIGHTING)
> if (GET_POS(i) != POS_MOUNTED)
>   blah blah
> else
>   blip blip
> 
> It should go right through to the ELSE shouldn't it? because right now its
> not, its doing the blah blah instead of the blip blip :(
> Anyone know why?

Try looking at it this way and the reason will be immediately obvious. :)

if(GET_POS(i)!=POS_FIGHTING)
  {
    if(GET_POS(i)!=POS_MOUNTED)
      {
        __blah blah__
      }
    else
      {
        __blip blip__
      }
  }

I vaguely remember an argument a long time ago about how people structured
their code... imho people should always use parentheses, especially when
in doubt... Also remember that else is always paired with the if statement
before it.

Alvoria MUD -- "Who's Arthur?"
  Address   -- telnet://conan.ids.net:4000/
  Homepage  -- http://users.ids.net/~mudguy/
  (under construction, perhaps not even updated for months to come)

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



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