Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Conditions
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Conditions

 Post Reply Post Reply
Author
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Topic: Conditions
    Posted: 11 October 2004 at 6:38am
Imagine this condition:

If A=A Or B=B Or C=C Or D=D Then

...
...
End If


If I know that only C=C, is it worth to place it first, so the ASP processing don't have to check other conditions first? Or does ASP always reads the whole line anyway?
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 11 October 2004 at 11:23am
It HAS to read the whole line anyway to see if there are any other conditions that do not hit.

i.e. The ASP Parser does not know you are going to do that so it read the whole line anyway incase theres something like this

Dim C, D
C = "Hello"
D = "Hi"

If (C = C)  And (C = D) Then
...
...
End If

Back to Top
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Posted: 11 October 2004 at 11:32am
Right, yes, it has to check the whole line because there could also be an (And) there, but if it was all (Or's), the parser could run to the next line since there's enough data for the condition to be met, seams wasteful otherwise.

(I'm always fascinated by these little things.)

Thanks.
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 11 October 2004 at 4:07pm

When you have a line like
If A=A Or B=B Or C=C Or D=D Then

There are inplied () around the equations. Most languages work from the inside out, so the equations are expanded/evaluated before the conditional operators - AND/OR's - are applied.


Lead me not into temptation... I know the short cut, follow me.
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 11 October 2004 at 4:25pm
I'm not certain but I think they always translate to AND conditions... i.e.

If (C = "Hello" Or C="Hi")  And (C = D) Then


The statements in parethesis will be converted to booleans so it ends up like

If True And False



Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.