>>>>>>Look at the switch command
>>>>>
>>>>>Switch will not help me in this case as I need 3 cases:
>>>>>
>>>>>Both variables defined
>>>>>
>>>>>startTime defined
>>>>>
>>>>>endTime defined
>>>>>
>>>>>I don't see how switch can help - switch is only for checking a single variable against predefined values.
>>>>
>>>>That's the problem.... if its not in a blog post, you can't figure it out....Learn to think outside a blog post...
>>>
>>>I don't see how it could be used in any efficient way since the parameter to a switch statement must be a simple type.
>>
>>Considering that each if/else if has two comparisons and a case only has one comparison, I think the switch solution is more efficient
>>
>>You can of course
>>
>>if( startTime < defaultDate )
>>{
>> if( endTime < defaultDate )
>> ;//
>> else if (endTime== defaultDate)
>> ; //
>> else
>> ;
>>}
>> else if (startTime == defaultDate )
>>{
>> if( endTime < defaultDate )
>> ;//
>> else if (endTime== defaultDate)
>> ; //
>> else
>> ;
>>}
>>else
>>{
>> if( endTime < defaultDate )
>> ;//
>> else if (endTime== defaultDate)
>> ; //
>> else
>> ;
>>}
>>
>
>TBH, I hadn't looked at your 'switch' version. I think you are right, and personally I find it more readable....
I find it nice also. But for some people it is way too complicated - rolling my eyes ;)
Gregory