dw_fluffos_v2/
dw_fluffos_v2/fluffos-2.9-ds2.05/
dw_fluffos_v2/fluffos-2.9-ds2.05/ChangeLog.old/
dw_fluffos_v2/fluffos-2.9-ds2.05/Win32/
dw_fluffos_v2/fluffos-2.9-ds2.05/compat/
dw_fluffos_v2/fluffos-2.9-ds2.05/compat/simuls/
dw_fluffos_v2/fluffos-2.9-ds2.05/include/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/clone/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/command/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/data/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/etc/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/include/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/inherit/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/inherit/master/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/log/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/single/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/single/tests/compiler/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/single/tests/efuns/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/single/tests/operators/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/u/
dw_fluffos_v2/fluffos-2.9-ds2.05/tmp/
dw_fluffos_v2/fluffos-2.9-ds2.05/windows/
dw_fluffos_v2/lib/
dw_fluffos_v2/lib/binaries/cmds/
dw_fluffos_v2/lib/binaries/cmds/creator/
dw_fluffos_v2/lib/binaries/cmds/living/
dw_fluffos_v2/lib/binaries/cmds/player/
dw_fluffos_v2/lib/binaries/d/admin/obj/
dw_fluffos_v2/lib/binaries/d/liaison/
dw_fluffos_v2/lib/binaries/global/virtual/
dw_fluffos_v2/lib/binaries/global/virtual/setup_compiler/
dw_fluffos_v2/lib/binaries/obj/handlers/autodoc/
dw_fluffos_v2/lib/binaries/obj/handlers/terrain_things/
dw_fluffos_v2/lib/binaries/obj/misc/
dw_fluffos_v2/lib/binaries/obj/misc/buckets/
dw_fluffos_v2/lib/binaries/obj/monster/
dw_fluffos_v2/lib/binaries/obj/reactions/
dw_fluffos_v2/lib/binaries/obj/reagents/
dw_fluffos_v2/lib/binaries/secure/cmds/creator/
dw_fluffos_v2/lib/binaries/secure/master/
dw_fluffos_v2/lib/binaries/std/
dw_fluffos_v2/lib/binaries/std/dom/
dw_fluffos_v2/lib/binaries/std/effects/object/
dw_fluffos_v2/lib/binaries/std/guilds/
dw_fluffos_v2/lib/binaries/std/languages/
dw_fluffos_v2/lib/binaries/std/races/
dw_fluffos_v2/lib/binaries/std/room/
dw_fluffos_v2/lib/binaries/std/room/basic/
dw_fluffos_v2/lib/binaries/std/shops/
dw_fluffos_v2/lib/binaries/std/shops/inherit/
dw_fluffos_v2/lib/binaries/www/
dw_fluffos_v2/lib/cmds/guild-race/
dw_fluffos_v2/lib/cmds/guild-race/crafts/
dw_fluffos_v2/lib/cmds/guild-race/other/
dw_fluffos_v2/lib/cmds/playtester/
dw_fluffos_v2/lib/cmds/playtester/senior/
dw_fluffos_v2/lib/d/admin/
dw_fluffos_v2/lib/d/admin/log/
dw_fluffos_v2/lib/d/admin/mapper/31-10-01/mapmaker/event/
dw_fluffos_v2/lib/d/admin/meetings/
dw_fluffos_v2/lib/d/admin/obj/
dw_fluffos_v2/lib/d/admin/room/we_care/
dw_fluffos_v2/lib/d/admin/save/
dw_fluffos_v2/lib/d/dist/
dw_fluffos_v2/lib/d/dist/mtf/
dw_fluffos_v2/lib/d/dist/pumpkin/
dw_fluffos_v2/lib/d/dist/pumpkin/chars/
dw_fluffos_v2/lib/d/dist/pumpkin/desert/
dw_fluffos_v2/lib/d/dist/pumpkin/gumboot/
dw_fluffos_v2/lib/d/dist/pumpkin/hospital/
dw_fluffos_v2/lib/d/dist/pumpkin/inherit/
dw_fluffos_v2/lib/d/dist/pumpkin/map/
dw_fluffos_v2/lib/d/dist/pumpkin/plain/
dw_fluffos_v2/lib/d/dist/pumpkin/pumpkin/
dw_fluffos_v2/lib/d/dist/pumpkin/save/
dw_fluffos_v2/lib/d/dist/pumpkin/squash/
dw_fluffos_v2/lib/d/dist/pumpkin/terrain/
dw_fluffos_v2/lib/d/dist/pumpkin/woods/
dw_fluffos_v2/lib/d/dist/start/
dw_fluffos_v2/lib/d/learning/TinyTown/buildings/
dw_fluffos_v2/lib/d/learning/TinyTown/map/
dw_fluffos_v2/lib/d/learning/TinyTown/roads/
dw_fluffos_v2/lib/d/learning/add_command/
dw_fluffos_v2/lib/d/learning/arms_and_weps/
dw_fluffos_v2/lib/d/learning/chars/
dw_fluffos_v2/lib/d/learning/cutnpaste/
dw_fluffos_v2/lib/d/learning/examples/npcs/
dw_fluffos_v2/lib/d/learning/examples/player_houses/npcs/
dw_fluffos_v2/lib/d/learning/examples/terrain_map/basic/
dw_fluffos_v2/lib/d/learning/functions/
dw_fluffos_v2/lib/d/learning/handlers/
dw_fluffos_v2/lib/d/learning/help_topics/npcs/
dw_fluffos_v2/lib/d/learning/help_topics/objects/
dw_fluffos_v2/lib/d/learning/help_topics/rcs_demo/
dw_fluffos_v2/lib/d/learning/help_topics/rooms/
dw_fluffos_v2/lib/d/learning/help_topics/rooms/crowd/
dw_fluffos_v2/lib/d/learning/help_topics/rooms/situations/
dw_fluffos_v2/lib/d/learning/items/
dw_fluffos_v2/lib/d/learning/save/
dw_fluffos_v2/lib/d/liaison/
dw_fluffos_v2/lib/d/liaison/NEWBIE/doc/
dw_fluffos_v2/lib/d/liaison/NEWBIE/save/oldlog/
dw_fluffos_v2/lib/db/
dw_fluffos_v2/lib/doc/
dw_fluffos_v2/lib/doc/creator/
dw_fluffos_v2/lib/doc/creator/autodoc/include/reaction/
dw_fluffos_v2/lib/doc/creator/autodoc/include/ritual_system/
dw_fluffos_v2/lib/doc/creator/autodoc/include/talker/
dw_fluffos_v2/lib/doc/creator/autodoc/include/terrain_map/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/baggage/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/clock/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/clothing/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/cont_save/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/corpse/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/money/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/monster/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/scabbard/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/service_provider/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/state_changer/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/wand/
dw_fluffos_v2/lib/doc/creator/autodoc/std/book_dir/
dw_fluffos_v2/lib/doc/creator/autodoc/std/key/
dw_fluffos_v2/lib/doc/creator/autodoc/std/learning/
dw_fluffos_v2/lib/doc/creator/autodoc/std/map/
dw_fluffos_v2/lib/doc/creator/autodoc/std/race/
dw_fluffos_v2/lib/doc/creator/autodoc/std/weapon_logic/
dw_fluffos_v2/lib/doc/creator/files/
dw_fluffos_v2/lib/doc/creator/policy/
dw_fluffos_v2/lib/doc/creator/room/
dw_fluffos_v2/lib/doc/effects/
dw_fluffos_v2/lib/doc/ideas/
dw_fluffos_v2/lib/doc/known_command/
dw_fluffos_v2/lib/doc/lpc/basic_manual/
dw_fluffos_v2/lib/doc/lpc/intermediate/
dw_fluffos_v2/lib/doc/new/add_command/
dw_fluffos_v2/lib/doc/new/handlers/
dw_fluffos_v2/lib/doc/new/living/
dw_fluffos_v2/lib/doc/new/living/race/
dw_fluffos_v2/lib/doc/new/living/spells/
dw_fluffos_v2/lib/doc/new/player/
dw_fluffos_v2/lib/doc/new/room/guild/
dw_fluffos_v2/lib/doc/new/room/outside/
dw_fluffos_v2/lib/doc/new/room/storeroom/
dw_fluffos_v2/lib/doc/object/
dw_fluffos_v2/lib/doc/playtesters/
dw_fluffos_v2/lib/doc/policy/
dw_fluffos_v2/lib/doc/weapons/
dw_fluffos_v2/lib/global/handlers/
dw_fluffos_v2/lib/global/virtual/setup_compiler/
dw_fluffos_v2/lib/include/
dw_fluffos_v2/lib/include/cmds/
dw_fluffos_v2/lib/include/effects/
dw_fluffos_v2/lib/include/npc/
dw_fluffos_v2/lib/include/shops/
dw_fluffos_v2/lib/net/daemon/chars/
dw_fluffos_v2/lib/net/inherit/
dw_fluffos_v2/lib/net/intermud3/
dw_fluffos_v2/lib/net/intermud3/services/
dw_fluffos_v2/lib/net/obj/
dw_fluffos_v2/lib/net/save/
dw_fluffos_v2/lib/net/smnmp/
dw_fluffos_v2/lib/net/snmp/
dw_fluffos_v2/lib/obj/amulets/
dw_fluffos_v2/lib/obj/b_day/
dw_fluffos_v2/lib/obj/examples/
dw_fluffos_v2/lib/obj/food/alcohol/
dw_fluffos_v2/lib/obj/food/chocolates/
dw_fluffos_v2/lib/obj/food/fruits/
dw_fluffos_v2/lib/obj/food/meat/
dw_fluffos_v2/lib/obj/food/nuts/
dw_fluffos_v2/lib/obj/food/seafood/
dw_fluffos_v2/lib/obj/food/vegetables/
dw_fluffos_v2/lib/obj/fungi/
dw_fluffos_v2/lib/obj/furnitures/artwork/
dw_fluffos_v2/lib/obj/furnitures/bathroom/
dw_fluffos_v2/lib/obj/furnitures/beds/
dw_fluffos_v2/lib/obj/furnitures/cabinets/
dw_fluffos_v2/lib/obj/furnitures/chairs/
dw_fluffos_v2/lib/obj/furnitures/chests/
dw_fluffos_v2/lib/obj/furnitures/clocks/
dw_fluffos_v2/lib/obj/furnitures/crockery/
dw_fluffos_v2/lib/obj/furnitures/cupboards/
dw_fluffos_v2/lib/obj/furnitures/cushions/
dw_fluffos_v2/lib/obj/furnitures/fake_plants/
dw_fluffos_v2/lib/obj/furnitures/lamps/
dw_fluffos_v2/lib/obj/furnitures/mirrors/
dw_fluffos_v2/lib/obj/furnitures/outdoor/
dw_fluffos_v2/lib/obj/furnitures/safes/
dw_fluffos_v2/lib/obj/furnitures/shelves/
dw_fluffos_v2/lib/obj/furnitures/sideboards/
dw_fluffos_v2/lib/obj/furnitures/sofas/
dw_fluffos_v2/lib/obj/furnitures/stoves/
dw_fluffos_v2/lib/obj/furnitures/tables/
dw_fluffos_v2/lib/obj/furnitures/wardrobes/
dw_fluffos_v2/lib/obj/handlers/
dw_fluffos_v2/lib/obj/handlers/autodoc/
dw_fluffos_v2/lib/obj/jewellery/anklets/
dw_fluffos_v2/lib/obj/jewellery/bracelets/
dw_fluffos_v2/lib/obj/jewellery/earrings/
dw_fluffos_v2/lib/obj/jewellery/misc/
dw_fluffos_v2/lib/obj/jewellery/necklaces/
dw_fluffos_v2/lib/obj/jewellery/rings/
dw_fluffos_v2/lib/obj/media/
dw_fluffos_v2/lib/obj/misc/buckets/
dw_fluffos_v2/lib/obj/misc/jars/
dw_fluffos_v2/lib/obj/misc/papers/
dw_fluffos_v2/lib/obj/misc/player_shop/
dw_fluffos_v2/lib/obj/misc/shops/
dw_fluffos_v2/lib/obj/misc/traps/
dw_fluffos_v2/lib/obj/monster/
dw_fluffos_v2/lib/obj/monster/godmother/
dw_fluffos_v2/lib/obj/monster/transport/
dw_fluffos_v2/lib/obj/plants/inherit/
dw_fluffos_v2/lib/obj/potions/
dw_fluffos_v2/lib/open/boards/
dw_fluffos_v2/lib/save/autodoc/
dw_fluffos_v2/lib/save/bank_accounts/
dw_fluffos_v2/lib/save/boards/frog/
dw_fluffos_v2/lib/save/books/bed_catalog/
dw_fluffos_v2/lib/save/creators/
dw_fluffos_v2/lib/save/mail/
dw_fluffos_v2/lib/save/mail/p/
dw_fluffos_v2/lib/save/soul/data/
dw_fluffos_v2/lib/save/tasks/
dw_fluffos_v2/lib/save/vaults/
dw_fluffos_v2/lib/secure/cmds/lord/
dw_fluffos_v2/lib/secure/config/
dw_fluffos_v2/lib/secure/items/
dw_fluffos_v2/lib/secure/player/
dw_fluffos_v2/lib/soul/
dw_fluffos_v2/lib/soul/i/
dw_fluffos_v2/lib/soul/j/
dw_fluffos_v2/lib/soul/k/
dw_fluffos_v2/lib/soul/o/
dw_fluffos_v2/lib/soul/q/
dw_fluffos_v2/lib/soul/to_approve/
dw_fluffos_v2/lib/soul/u/
dw_fluffos_v2/lib/soul/v/
dw_fluffos_v2/lib/soul/wish_list/
dw_fluffos_v2/lib/soul/y/
dw_fluffos_v2/lib/soul/z/
dw_fluffos_v2/lib/std/creator/
dw_fluffos_v2/lib/std/effects/
dw_fluffos_v2/lib/std/effects/attached/
dw_fluffos_v2/lib/std/effects/external/
dw_fluffos_v2/lib/std/effects/fighting/
dw_fluffos_v2/lib/std/effects/other/
dw_fluffos_v2/lib/std/environ/
dw_fluffos_v2/lib/std/guilds/
dw_fluffos_v2/lib/std/hospital/
dw_fluffos_v2/lib/std/house/
dw_fluffos_v2/lib/std/house/onebedhouse/
dw_fluffos_v2/lib/std/house/onebedhut/
dw_fluffos_v2/lib/std/house/tworoomflat/
dw_fluffos_v2/lib/std/languages/
dw_fluffos_v2/lib/std/liquids/
dw_fluffos_v2/lib/std/nationality/
dw_fluffos_v2/lib/std/nationality/accents/
dw_fluffos_v2/lib/std/nationality/accents/national/
dw_fluffos_v2/lib/std/nationality/accents/regional/
dw_fluffos_v2/lib/std/npc/goals/
dw_fluffos_v2/lib/std/npc/goals/basic/
dw_fluffos_v2/lib/std/npc/goals/misc/
dw_fluffos_v2/lib/std/npc/inherit/
dw_fluffos_v2/lib/std/npc/plans/
dw_fluffos_v2/lib/std/npc/plans/basic/
dw_fluffos_v2/lib/std/outsides/
dw_fluffos_v2/lib/std/races/shadows/
dw_fluffos_v2/lib/std/room/basic/topography/
dw_fluffos_v2/lib/std/room/controller/
dw_fluffos_v2/lib/std/room/controller/topography/
dw_fluffos_v2/lib/std/room/furniture/games/
dw_fluffos_v2/lib/std/room/furniture/inherit/
dw_fluffos_v2/lib/std/room/inherit/carriage/
dw_fluffos_v2/lib/std/room/inherit/topography/
dw_fluffos_v2/lib/std/room/punishments/
dw_fluffos_v2/lib/std/room/topography/area/
dw_fluffos_v2/lib/std/room/topography/iroom/
dw_fluffos_v2/lib/std/room/topography/milestone/
dw_fluffos_v2/lib/std/shadows/
dw_fluffos_v2/lib/std/shadows/attached/
dw_fluffos_v2/lib/std/shadows/curses/
dw_fluffos_v2/lib/std/shadows/disease/
dw_fluffos_v2/lib/std/shadows/fighting/
dw_fluffos_v2/lib/std/shadows/room/
dw_fluffos_v2/lib/std/shops/controllers/
dw_fluffos_v2/lib/std/shops/objs/
dw_fluffos_v2/lib/std/shops/player_shop/
dw_fluffos_v2/lib/std/shops/player_shop/office_code/
dw_fluffos_v2/lib/std/socket/
dw_fluffos_v2/lib/www/
dw_fluffos_v2/lib/www/external/autodoc/
dw_fluffos_v2/lib/www/external/java/telnet/Documentation/
dw_fluffos_v2/lib/www/external/java/telnet/Documentation/images/
dw_fluffos_v2/lib/www/external/java/telnet/examples/
dw_fluffos_v2/lib/www/external/java/telnet/tools/
dw_fluffos_v2/lib/www/pics/
dw_fluffos_v2/lib/www/secure/creator/
dw_fluffos_v2/lib/www/secure/editors/
dw_fluffos_v2/lib/www/secure/survey_results/
dw_fluffos_v2/win32/
<html><!-- #BeginTemplate "/Templates/Body Text.dwt" -->
<head>
<title> Discworld Documentation </title>
</head>
<body bgcolor="#ffffff" TEXT="#000030" LINK="#4a529c" VLINK="#b57339">
<table width="75%" border="0">
  <tr>
    <td><font face="arial,helvetica"><img align=left src="http://discworld.imaginary.com/external//pics/dw4.gif"></font></td>
    <td><font face="arial,helvetica">
      <h2>Discworld Documentation:</h2>
      <h2>LPC for Dummies</h2>
      </font> 
      <p><font size="+1"><!-- #BeginEditable "Title" --><font size="+1"><font size="+1"><b>Chapter 
  Six: LPC Operators</b></font></font><!-- #EndEditable --></font></p>
      <p><i>N.B - This is a work in progress... a living document if you like. 
        If it appears to be dead when you view it, don't worry. It's most likely 
        just playing possum.</i></p>
      <p>Comments on these chapters and tutorials can be e-mailed to <a href="mailto:drakkos@cableinet.co.uk">Drakkos.</a></p>
    </td>
  </tr>
</table>
<br>
<!-- #BeginEditable "Body" --> 
<p>In the previous chapter, we talked about how we can use various types of structures 
  to alter the flow of execution through your programs. In each of the previous 
  examples, we used only very simple conditional expressions, based only on a 
  single value. In this chapter, we will discuss how to utilise the various operators 
  available in LPC in order to build more complex conditional expressions. We 
  will also look at the mathematical operators and how these can be used within 
  your code to manipulate constant values and variables. Be warned, this chapter 
  may be a little heavy going at first, so don't be discouraged if you don't follow 
  exactly what each of these operators do to begin with. Persevere, and reread 
  the offending sections again, paying particular attention to the examples. It 
  will all become second nature eventually, I promise! 
<p><b>Mathematical Operators </b> 
<p>Several of the mathematical operators we have already discussed in the section 
  on data types. We will revise what we learned in that section here, and add 
  some new operators we may use when developing our code. The '+' operator is 
  the addition operator. We may use the + operator on ints, floats, strings, mappings 
  and arrays. In the case of ints and floats, the value of the elements are added 
  together and the result returned. In the case of strings, arrays, and mappings, 
  the elements are concatenated together: 
<blockquote> 
  <p><code>int x = 1 + 2; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    x equals 3<br>
    float x = 1.02 + 3.3; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    x equals 4.32<br>
    string x = "bing" + "bong" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    x equals "bingbong" <br>
    mapping x = (["bing": "bong"]) + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    x equals ({"bing": "bong", <br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(["wibble" 
    :"wobble"]) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"wibble":"wobble"]) 
    <br>
    string *x = ({"bing", "bong"}) + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    x equals ({"bing", "bong", <br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    ({"wibble", "wobble"}); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"wibble", 
    "wobble"}) </code></p>
</blockquote>
<p>We can use the + operator to add/concatenate as many different elements as 
  required: 
<blockquote> 
  <p><code>int x = 1 + 2 + 3 + 4 + 5; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    x equals 15. </code></p>
</blockquote>
<p>The '-' operator is the subtraction operator. We may use the - operator on 
  ints, floats, and arrays. In the case of ints and floats, the elements are subtracted 
  from left to right. In the case of arrays, the element, if it exists, is subtracted 
  from the array from left to right: 
<blockquote> 
  <p><code>int x = 7 - 5; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    x equals 2<br>
    float x = 5.02 - 2.02; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    x equals 3.00 <br>
    string *x = ({"bing", "bong", &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    // x equals ({"bing, wibble"})<br>
    &nbsp;&nbsp;&nbsp;&nbsp; </code><code>"wibble"}) -({"bong"}) </code></p>
  </blockquote>
<p>Again, we can use the - operator to subtract as many different elements as 
  required. This is done left to right: 
<blockquote> 
  <p><code>int x = 10 - 2 - 3; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    x equals 5. </code></p>
</blockquote>
<p>The '*' operator is the multiplication operator, and may be used on ints and 
  floats: 
<blockquote> 
  <p><code>int x = 10 * 8; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    x equals 80<br>
    float x = 1.10 * 4.5; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    x equals 4.95 </code></p>
</blockquote>
<p>Again, this can be used repeatedly, the calculations being performed from left 
  to right: 
<blockquote> 
  <p><code>float x = 1.10 * 4.5 * 10; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    x equals 49.5 </code></p>
</blockquote>
<p>The '/' operator is the division operator, and may only be used on ints and 
  floats: 
<blockquote> 
  <p><code>int x = 10 / 2; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    x equals 5<br>
    float x = 4.4 / 1.1; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    x equals 4 </code></p>
</blockquote>
<p>The operator precedence is from left to right: 
<blockquote> 
  <p><code>int x = 10 / 5 / 2 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    // x equals 1 </code></p>
</blockquote>
<p>The final mathematical operator is the modulus operator, '%', and returns the 
  remainder of the elements. This will work only with integers: 
<blockquote> 
  <p><code>int x = 14 % 3; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    x equals 2. </code></p>
</blockquote>
<p>In all cases, we can combine different operators in a single expression. The 
  mathematical precedence order of multiplication, division, addition, then subtraction 
  is preserved, so if you wish to ensure certain parts of the expression are calculated 
  independent, you must enclose them in parenthesis: 
<blockquote> 
  <p><code>int x = 10 + 2 * 5 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    This calculates 5 * 2 <br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    first, and then adds the <br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    &nbsp;// result to 10, giving 20.<br>
    </code><code><br>
    int x = (10 + 2) * 5 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    // This will calculate 10 + 2<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    before multiplying the result<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 
    by 5 to get 60. </code></p>
  </blockquote>
<p>Through the combination of these operators, and enforced precedence through 
  the use of parenthesis, complicated mathematical expressions can be built up. 
<p><b>Incremental and Decremental Operators </b> 
<p>The other semi-mathematical operators you are likely to come across as a creator 
  on Discworld are the post and pre-increment/decrement operators. ++ and --. 
  We've already seen them in the section on data types, but we'll take a closer 
  look at them here. The post increment operator takes the form: 
<blockquote>
  <p><code>x++</code></p>
</blockquote>
<p>The pre increment takes the form 
<blockquote>
  <p><code>++x </code></p>
</blockquote>
<p>The difference between the two is the order in which they do things. The first 
  returns the value of x before the expression is used, and then increments it 
  by one. The second increments it in one then uses the expression: 
<blockquote> 
  <p><code>int x = 5;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; // x equals 5<br>
    int y = x++; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// y equals 
    5<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;// x equals 6<br>
    <br>
    int x = 5; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;// 
    x equals 5 <br>
    int y = ++x; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// y equals 
    6<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;// x equals 6</code></p>
</blockquote>
<p> In the first case, we're using the value of x as it stands (at 5), and then 
  increasing the value by one. In the second, we are increasing the value of x 
  by one, and returning that to y. The pre and post decrement operators are of 
  the same form and meaning: </p>
<blockquote> 
  <p><code>int x = 5; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp;// x equals 5<br>
    int y = x--; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// y equals 
    5 <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;// x equals 4 </code></p>
  <p><code>int x = 5; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp;// x equals 5 <br>
    int y = --x; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// y equals 
    4 <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;// x equals 4. </code></p>
</blockquote>
<p><b>Assignment Operators </b> 
<p>LPC offers a range operators to abbreviate assignments. Assignments are usually 
  performed using the assignment '=' operator. However, if we are performing mathematical 
  assignments, such as: 
<blockquote>
  <p><code>int x = 5; <br>
    x = x + 5; </code></p>
</blockquote>
<p>We can abbreviate the code one of the abbreviation assignment operators. 
<p>Operators in this category are the additive assignment '+=', the subtractive 
  assignment '-=', the mutilative assignment '*=', the divisive assignment '/=', 
  and the modular assignment '%='. 
<p>We can sum the use of these operators up in the following table 
<pre>         ---------------------------------------------------
        |               |               |                   |
        |   Operator    |   Expression  |   Equivalent to   |
        |               |               |                   |  
         ---------------------------------------------------
        |               |               |                   |
        |     +=        |     x += 5    |     x = x + 5     |
        |     -=        |     x -= 5    |     x = x - 5     |
        |     *=        |     x *= 5    |     x = x * 5     |
        |     /=        |     x /= 5    |     x = x / 5     |
        |     %=        |     x %= 5    |     x = x % 6     |
        |               |               |                   |
         ---------------------------------------------------
</pre>
<p>We can use these operators on the same types of data we can use the equivalent 
  arithmetic operator on. So we can use += on ints, floats, mappings, arrays and 
  strings, whereas we can use %= only on int. 
<p><b>Equality Operators </b> 
<p>The comparative operators are used to compare the value of one side of the 
  operator against the other. We have three operators that fall under this category... 
  the equals operator (<code>==</code>), the does not equal operator (<code>!=</code>), 
  and the not operator (<code>!</code>). We'll look at each of these in turn. 
<p>The equals operator is ==. Note that the two equals signs... = and == mean 
  two entirely different things in LPC. = is the assignment operator, and will 
  make the variable on the left equal to the value on the right. The == operator, 
  however, will compare the two and return true if they are equal: 
<blockquote> 
  <p><code>if (x == y) {<br>
    &nbsp;&nbsp;&nbsp; printf ("X equals Y!\n"); <br>
    }</code></p>
</blockquote>
<p> Now, let's suppose that we initialise the variables like so: 
<blockquote>
  <p><code>int x = 5, y = 10; </code></p>
</blockquote>
<p>In our if condition, this is evaluated as: 
<blockquote>
  <p><code>if (5 == 10) </code></p>
</blockquote>
<p>Quite obviously 5 does not equal 10, and so the condition is evaluated to false. 
  The code belonging to the if statement is not executed. But if we initialised 
  the variables as: 
<blockquote>
  <p><code>int x = 5, y = 5; </code></p>
</blockquote>
<p>The the condition would be evaluated as: 
<blockquote>
  <p><code>if (5 == 5) </code></p>
</blockquote>
<p>Which is obviously true, and so will allow the statements belonging to the 
  if statement to be executed. We can compare the value of variables against solid 
  values also: 
<blockquote> 
  <p><code>int x = 5;</code></p>
  <p><code> if (x == 5) </code></p>
</blockquote>
<p>Which would evaluate as: 
<blockquote>
  <p><code>if (5 == 5) </code></p>
</blockquote>
<p>We can use the equals operator on any variable type, provided the comparison 
  is homogeneous... that we don't try and compare one type of variable against 
  another type: 
<blockquote> 
  <p><code>string x = "bing"; </code></p>
  <p><code>if (x == "bing") </code></p>
</blockquote>
<p>Is fine, while: 
<blockquote> 
  <p><code>string x = "bing"; </code></p>
  <p><code>if (x == 5) </code></p>
</blockquote>
<p>Will throw out a parse error. If we are checking to see if the string x contains 
  the alphadecimal character 5, we must enclose the 5 in quotation marks: 
<blockquote>
  <p><code>if (x == '5') </code></p>
</blockquote>
<p>If we are interested in the inverse, when a variable does not equal the other, 
  we can use the != operator: 
<blockquote> 
  <p><code>int x = 5, y = 10; </code></p>
  <p><code>if (x != y) </code></p>
</blockquote>
<p>In this case, we're checking to see if 5 does not equal 10. Since it doesn't, 
  the condition evaluates as true and the code belonging to the if statement is 
  executed. 
<blockquote> 
  <p><code>int x = 5, y = 5; </code></p>
  <p><code>if (x != y) </code></p>
</blockquote>
<p>In this case, we're checking to see if 5 does not equal 5. Unfortunately, it 
  does, so the code in the if statement will not be executed. The final equality 
  operator is the ! operator. This is used in a slightly different way, and returns 
  true if the value of the operator is false. Mind bending? Well, yeah... it sounds 
  that way. But it's easy in practise. In LPC, any value other than 0 will return 
  true in a conditional expression. All variables that haven't been assigned a 
  value have a 0 value: 
<blockquote> 
  <p><code>int x, y = 10; </code></p>
  <p><code>if (!x) </code></p>
</blockquote>
<p>x has not been assigned here, so the condition evaluates to true. However, 
  since we have assigned y the value of 10, the condition (!y) will evaluate as 
  false. If we have a function that returns either a zero or another value, we 
  can utilise the ! operator to base the condition on that value: 
<blockquote>
  <p><code>if (some_function()) </code></p>
</blockquote>
<p>Will evaluate as true if some_function() returns anything other than 0. 
<blockquote>
  <p><code>if (!some_function()) </code></p>
</blockquote>
<p>Will evaluate as true if some_function returns 0. If it returns anything else 
  at all, it will evaluate as false. 
<p><b>Relational Operators </b> 
<p>The relational operators evaluate in terms of the relation between the conditional 
  elements. The relational operators are greater than (>), less than (<), greater 
  than or equal to (>=), and less than or equal to (<=). The greater than operator 
  returns true if the first part of the condition is greater than the second part: 
<blockquote> 
  <p><code>int x = 5, y = 10; </code></p>
  <p><code>if (x > y) </code></p>
</blockquote>
<p>5 is not greater than 10, however, so the condition evaluates as false. If 
  we change the order, however: 
<blockquote>
  <p><code>if (y > x) </code></p>
</blockquote>
<p>10 is indeed greater than 5, so the condition evaluates to true. 
<p>The less than operator works the other way around. If the first element is 
  less than the second element, the condition evaluates to true. Otherwise, it 
  evaluates to false: 
<blockquote> 
  <p><code>int x = 5, y = 10; </code></p>
  <p><code>if (x < y) </code></p>
</blockquote>
<p>5 is less than 10, so the condition evaluates to true. 
<blockquote>
  <p><code>if (y < x) </code></p>
</blockquote>
<p>10 is not less than 10, so the condition evaluates to false. In both cases, 
  if the first element equals the second element, the condition will evaluate 
  as false: 
<blockquote> 
  <p><code>int x = 5, y = 5; </code></p>
  <p><code>if (x < y) <br>
    if (y < x) <br>
    if (x > y) <br>
    if (y > x) </code></p>
</blockquote>
<p>All four of these conditions will evaluate as false. If we wish to provide 
  for the elements being equal to each other, we must use the <= or >= operators. 
  These work exactly the same as above, except that they will also evaluate as 
  true if x is equal to y: 
<blockquote> 
  <p><code>int x = 5, y = 5; </code></p>
  <p><code>if (x <= y) <br>
    if (y <= x) <br>
    if (x >= x) <br>
    if (y >= y) </code></p>
</blockquote>
<p>All the above conditions will evaluate as false. In all other respects, the 
  <= and >= behave in exactly the same way as the < and > operators. 
<p><b>Logical Operators </b> 
<p>Now that we've looked at the basic mathematical, equality, and relational operators, 
  let's look a little at the logical operators we can use. We use these in particular 
  with the conditionals in the structures we discussed in the last chapter, and 
  we use them to join simple expressions into compound complex expressions. The 
  main logical operators are && (and) || (or). The && operator is used when both 
  expressions must evaluate to true before the condition as a whole evaluates 
  to true: 
<blockquote> 
  <p><code>int x = 5, y = 10; </code></p>
  <p><code>if (x == 5 && y == 10) </code></p>
</blockquote>
<p>If both of these equality checks are true, then the condition as a whole will 
  evaluate to true. If either one evaluates to false, then so does the if condition. 
  If both are false, then the condition is again evaluated to false. We can summarise 
  this in what is known as a truth table. For two conditions, the truth table 
  looks like so: 
<pre>         _______________________________________________
        |               |               |               |
        |   Expression  |   Expression  |   Condition   |
        |      One      |      Two      |               |
         -----------------------------------------------
        |     False     |     False     |     False     |
        |     True      |     False     |     False     |
        |     False     |     True      |     False     |
        |     True      |     True      |     True      |
        |               |               |               |
         -----------------------------------------------  
</pre>
<p>In other words, one false evaluation will cause the whole condition to evaluate 
  to false. Note that it is good practise to enclose separate clauses of a condition 
  in parenthesis to ensure they are evaluated separately, so we'd write our condition 
  as: 
<blockquote>
  <p><code>if ((x == 5) && (y == 10)) </code></p>
</blockquote>
<p>In this case, since we assigned 5 to x and 10 to y, the condition does indeed 
  evaluate as true. 
<p>The || or operator is used similarly to link two simple conditions together, 
  but only requires one of the expressions to be true before the whole condition 
  evaluates as true: 
<blockquote>
  <p><code>if ((x == 5) || (y == 10)) </code></p>
</blockquote>
<p>The if condition would evaluate as true if x was 5, or if y was 10, or if both 
  of them were true. The truth table for this looks like: 
<pre>         _______________________________________________
        |               |               |               |
        |   Expression  |   Expression  |   Condition   |
        |      One      |      Two      |               |
         -----------------------------------------------
        |     False     |     False     |     False     |
        |     True      |     False     |     True      |
        |     False     |     True      |     True      |
        |     True      |     True      |     True      |
        |               |               |               |
         -----------------------------------------------          

</pre>
<p>Only if all expressions evaluate as false will the whole condition evaluate 
  to false. We can combine these two logical operators to create even more complex 
  expressions: 
<blockquote>
  <p><code>if (((x == 5) || (y == 10)) && (x > y)) </code></p>
</blockquote>
<p>Expressions are evaluated left to right, and from the inside out... expressions 
  within the parenthesis are evaluated first. So first we evaluate 
<blockquote>
  <p><code>((x == 5) || (y == 10)) </code></p>
</blockquote>
<p>The first of these we evaluate is the left most expression: (x == 5) And then 
  the next one: (y == 10) If either of these evaluate to true, then the whole 
  condition within the brackets: 
<blockquote>
  <p><code>((x == 5) || (y == 10)) </code></p>
</blockquote>
<p>Evaluates as true. Assuming this is the case, we then attempt to evaluate the 
  second part of the condition: 
<blockquote>
  <p><code>(x > y) </code></p>
</blockquote>
<p>Since we are linking the first compound statement 
<blockquote>
  <p><code>((x == 5) || (y == 10)) </code></p>
</blockquote>
<p>to the simple statement with an && operator, both conditions have to evaluate 
  as true. Note that anything within parenthesis can be considered a single expression 
  with multiple parts. Don't worry too much if you don't follow how compound logical 
  operations work. It will make sense after practise. 
<p><b>Chapter Summary </b> 
<p>That's it for this chapter. We haven't covered all of the operators available 
  as part of the LPC environment, but we've covered the ones you're most likely 
  to need as a Discworld creator. The other operators are for much more specialised 
  areas and aren't likely to appear until you have more experience as a creator. 
  The information contained within this document is important to learn, so if 
  you don't quite follow it the first time, please make the effort to reread and 
  practise until the concepts make sense. 
<ul>
  <li><code>The mathematical are *, /, -, + and %. </code></li>
  <li><code>The mathematical operators are evaluated left to right, unless the 
    precedence is altered through the use of parenthesis. </code></li>
  <li><code>The + operator works on ints, floats, mappings, arrays, and strings. 
    </code></li>
  <li><code>The - operator works on ints, floats and arrays. </code></li>
  <li><code>The / and * operators work on ints and floats alone. </code></li>
  <li><code>The % operator works only on integers. </code></li>
  <li><code>The assignment operators are =+, -=, *=, /= and %=. </code></li>
  <li><code>The additional assignment operator x += y is equivalent to x = x + 
    y. </code></li>
  <li><code>The subtractive assignment operator x -= y is equivalent to x = x 
    - y. </code></li>
  <li><code>The mutiplative assignment operator x *= y is equivalent to x = x 
    * y. </code></li>
  <li><code>The divisive assignment operator x /= y is equivalent to x = x / y. 
    </code></li>
  <li><code>The modular assignment operator x %= y is equivalent to x = x % y. 
    </code></li>
  <li><code>The equality operators are ==, !=, and !. </code></li>
  <li><code>The == operator evaluates as true if both sides of the expression 
    are equal. </code></li>
  <li><code>The != operator evaluates as true if both sides of the expression 
    do not equal each other. </code></li>
  <li><code>The ! operator evaluates as true if the expression following it evaluates 
    as false. </code></li>
  <li><code>The relational operators are <, >, <= and >=. </code></li>
  <li><code>The > operator evaluates as true when the left side of the operator 
    is greater than the right side. </code></li>
  <li><code>The < operator evaluates as true when the left side of the operator 
    is less than the right side. </code></li>
  <li><code>The <= and >= operators are equivalent to < and >, but also evaluate 
    as true when the right side of the operator is equal to the left side. </code></li>
  <li><code>The logical operators are && and ||, and are used to create compound 
    conditions from simple conditions. </code></li>
  <li><code>The && logical operator evaluates as true only if all parts of the 
    compound condition evaluate as true. </code></li>
  <li><code>The || logical operator evaluates as true if any part of the compound 
    condition evaluates as true. </code></li>
</ul>
<!-- #EndEditable --> 
<p>
<hr>
<center><font size="-1"><a href="/login.html">Discworld MUD</a>'s world wide web pages.<br>brought to you by<br>
  <strong>Cut Me Own Throat Dibbler's <a href="/sausages.html">Sensational Sausages</a>;&nbsp;buy 
  one while they are hot.</strong> <br>
<hr>Lost?  Try Discworld's <a href="/">home page</a>.</font></center><font size="-1"><i><a href="mailto:drakkos@cableinet.co.uk"><font size="-2">Mail Drakkos!</font></a></i>
</font>
</body>
<!-- #EndTemplate --></html>