4 Replies Latest reply on Mar 22, 2011 12:54 PM by fitch

    Does this make a difference?  Which way is better?

    c.wagner1

      Title

      Does this make a difference?  Which way is better?

      Post

      Hi Guys,

      I have a script that needs to evaluate a statement containing about 20 conditionals.  Which of these 2 methods is better?  (I am going to shorten my example just a bit)

      Assume for this example their are 4 global variables containing a number:

      $$w, $$x, $$y, and $$z and we only want to preform doSomething if w=500, x=200, y=100 and z=50.

      I could do a script like this:

      Example 1

      Set Variable[$flag; Value:True]

      If [$$w <> 500 or $$x <> 200 or $$y <> 100 or $$z <> 50]

      Set Variable[$flag; Value:False]

      End If

      If [$flag = True]

      doSomething

      End If

      or I could do something like this:

      Example 2

      If [$$w = 500]

      If [$$x = 200]

      If [$$y = 100]

      If [$$z = 50]

      doSomething

      End If

      End If

      End If

      End If

      Both examples should evaluate the same.  Imaging I had 20 - 25 values of compare which way would you use?  Will one of the two 

      perform faster?

      Chris