[Gambas-user] To wish list: Select with multiple variables

Jussi Lahtinen jussi.lahtinen at ...626...
Mon Jun 20 21:14:27 CEST 2011


I think I'm having short circuit in my brain, so this might be stupid
suggestion...
But I would like to see feature illustrated by following example:

  Select Case bVar1; bVar2; bVar3; iVar

    Case True; True; True; 1 To 10
    'Do something

    Case False; True; True; 11 To 20
    'Do something else

    ... etc ...

    Case Else
    'All other combinations are handled here

  End Select


This would be great way to simplify complicated "If Then Else" structures,
anyone agree..?
I could implement this same functionality with two functions (using Param
for arguments and return string from functions):

  Select Case fCondition(bVar1, bVar2, bVar3, iVar)

    Case fCase(True, True, True, "1 to 10")
    'Do something

    Case fCase(False, True, True, "11 to 20")
    'Do something else

    ... etc ...

    Case Else
    'All other combinations are handled here

  End Select


But I'm afraid it would be too resource hungry.
Better ideas?

Jussi



More information about the User mailing list