Listing 9.16 - If then Statements defy logic!

Results 1 to 2 of 2

Thread: Listing 9.16 - If then Statements defy logic!

  1. #1
    Rene Guest

    Default Listing 9.16 - If then Statements defy logic!

    Hi guys, I was reading through listing 9.16 on page 290, and lines 45-49 each create If Then Statements. My confusion is this: Why don't any of these If Then statements have any End If statements, and why does this script work fine without them? Additionally, these statements seem to defy the rules of nested statements defined on page 95. I thought that the second If Then statement would not be executed unless the first one was true in a nested If Then statement. I tried leaving the first condition unchecked in this example, but it still went on to the second statement. Could you please explain. I am all of the sudden confused on something I thought I understood perfectly yesterday! Thanks.

  2. #2
    Join Date
    Dec 1969

    Default RE: Listing 9.16 - If then Statements defy logic!

    If you use IF in one line, there is no need END IF.<BR><BR>IF xxx THEN DoA ELSE DoB<BR>IF yyy THEN DoC<BR>If zzz Then DoD<BR><BR>In above example, If xxx is true, DoA, else DoB. (first IF finished)<BR><BR>If yyy is true, DoC (second IF finished)<BR>If zzz is true, DoD (third IF finished)<BR><BR>If there is only one statement need to execute and simple, it is better that we put it in one line to make it more readable.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts