Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Computer Programming Logic 101

Author
Message
Pheonixx
20
Years of Service
User Offline
Joined: 6th Oct 2003
Location: Columbus, Ohio
Posted: 19th Mar 2006 00:39
LESSON 1:



LESSON 2:



LESSON 3:



LESSON 4:



LESSON 5:



http://ausukusa.breakset.com
GatorHex
19
Years of Service
User Offline
Joined: 5th Apr 2005
Location: Gunchester, UK
Posted: 19th Mar 2006 00:44 Edited at: 19th Mar 2006 00:48
I did it was funny I can't believe you spend your time writing all that

if you got some more time, do some code to see if "case" is faster than "if" in a million loops plx
NewGuy
18
Years of Service
User Offline
Joined: 11th Nov 2005
Location: Interdimensional vortex
Posted: 19th Mar 2006 00:46
cool
Pheonixx
20
Years of Service
User Offline
Joined: 6th Oct 2003
Location: Columbus, Ohio
Posted: 19th Mar 2006 00:54
For a single comparitor, IF is always faster then SELECT. When you are looking at a variable for more then one literal value, SELECT is always faster then IF.

When you have a SELECT switch already setup, all you have to do in order to add in one more literal is add another CASE, but for an IF statement, you'd have to make a whole 'nother comparitor.

These things are at the machine functionality level.

ELSE is essentially the inverse of the IF logic, so using an IF/ELSE/ENDIF is actually running two comparitors, however with a SELECT comparitor, DEFAULT just catches whatever values weren't picked up by the preceding literal comparissons.

Every Time you put an AND/OR/NOT/XOR/== literal or >/< non-literal in an IF statement you are increasing the amount of Comparitors the program is going to run, that's where cascading IF statements can speed things up, by putting the condition most likely to fail first.

Both IF's and SELECT's are extremely powerful, and I hope this little attempt at humor sincerely helps some developers understand the basics.

http://ausukusa.breakset.com

Login to post a reply

Server time is: 2024-09-24 19:34:30
Your offset time is: 2024-09-24 19:34:30