SELECT / ACTIVE vs IF / ELSE
Table of Contents
Brand:
- [List Brands]
Models/Languages:
- [List Models/Language as appropriate.]
Overview:
SELECT / ACTIVE vs IF / ELSE
Usage:
- Use SELECT/ACTIVES if you find you need to check multiple logical statements and find you need more than one IF ELSE.
Code:
Use SELECT/ACTIVES if you find you need to check multiple logical statements and find you need more than one IF ELSE. For example, instead of:
IF (<statement 1>)
{
do something
}
ELSE IF (<statement 2>)
{
do another thing
}
ELSE IF (<statement 3>)
{
do something else entirely
}
ELSE
{
do default thing
}
This SELECT/ACTIVE will run faster than the IF/ELSE's:
SELECT
{
ACTIVE (<statement 1>):
{
do something
}
ACTIVE (<statement 2>):
{
do another thing
}
ACTIVE (<statement 3>):
{
do something else entirely
}
ACTIVE (1):
{
do default thing
}
} Table of Contents