Difference between revisions of "Talk:If"

723 bytes added ,  21:33, 25 August 2008
no edit summary
imported>Haama
(Testing negative numbers)
imported>Antares
Line 90: Line 90:
  if ((SomeVar + 1) >= 0)
  if ((SomeVar + 1) >= 0)
Are negative numbers not handled properly? Do they need to be set to a variable first? Thought I'd seen so on another page, but it's not on this one (where it should be).--[[User:Haama|Haama]] 19:04, 8 July 2008 (EDT)
Are negative numbers not handled properly? Do they need to be set to a variable first? Thought I'd seen so on another page, but it's not on this one (where it should be).--[[User:Haama|Haama]] 19:04, 8 July 2008 (EDT)
== Nested IF's ==
Can someone explain to me nested IF's and how exactly they differ from using an && operator? I feel this is unclear in the article and it has produced its fair share of "Gotcha's" in my scripting endeavours.
For example:
<pre> If ( GetItemCount Item1 == 1 ) && ( GetItemCount Item2 == 1 )
  ;Do something here
endif</Pre>
How exactly is the above code different from this:
<pre> If GetItemCount Item1 == 1
  If GetItemCount Item2 == 1
  ;Do something here
endif
  endif</pre>
Except, of course, for the added lines of code. It would seem using the && operator is more effecient but I prefer to use nested IF's as I've found they work for me???--[[User:Antares|Antares]] 22:33, 25 August 2008 (EDT)
Anonymous user