if($price > 100)
{
//too high
tooHigh()
}
elseif($price > 70) //it wasn't greater than 100 - is it greater than 70?
{
//negotiate
negotiate()
}
elseif($price > 20) //OK, wasn't greater than 70 OR 100 - greater than 20 then?
{
//accept
accept()
}
else //Guess not - just don't do anything
{
//thank and escape
thankAndEscape()
}
Case statements can't do conditions unfortunately. They really are 'if this is the case then...' in brutal honesty
This should work as the conditions will simply fall through to the next until it reaches the bottom. if one matches - the rest of the statement is ignored... Thats if I have my logic the right way up...
I don't think you'll need to do the range matching as is already native to the if statement. For example. The statement 'between 70 and 20 ' is simplified to above 20 lower than 70 in seperated conditions. A little more efficient and easier to read.