Page 1 of 1

[Implemented] Select... MultiCase

Posted: Wed Jun 05, 2002 6:42 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.

From the german forum wishlist.

Ralf61´s wish for PureBasic:
Select...Case with multiple arguments for CASE

Code: Select all

Select value
       Case 1,3,4
            ; here code for Value = 1, 3 or 4
       Case 2,5,6
            ; here code for Value = 2, 5 or 6
Endselect 
German PureBasic Forum, http://www.Pure-Board.de

Edited by - Danilo on 11 June 2002 06:06:09

Posted: Wed Jun 05, 2002 12:34 pm
by BackupUser
Restored from previous forum. Originally posted by Rings.

YES !

Its a long way to the top if you wanna .....CodeGuru

Posted: Wed Jun 05, 2002 4:13 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.

I like this too...

But the correct PureBasic syntax would be:

Code: Select all

Select Value
  Case 1 Or 3 Or 4
    ; here code for Value = 1, 3 or 4       
  Case 2 Or 5 Or 6        
    ; here code for Value = 2, 5 or 6
Endselect 
 

This syntax would be similar to the 'If' function...


Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.

Posted: Thu Jun 06, 2002 5:02 am
by BackupUser
Restored from previous forum. Originally posted by plouf.

yes and also

case 1 to 10 ; for all numbers from 1 until 20

as i have asked long time ago :wink:

Christos

Posted: Thu Jun 06, 2002 3:46 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.
case 1 to 10 ; for all numbers from 1 until 20
Are you sure


Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.

Posted: Thu Jun 06, 2002 4:41 pm
by BackupUser
Restored from previous forum. Originally posted by Rings.
yes and also

case 1 to 10 ; for all numbers from 1 until 20

as i have asked long time ago :wink:

Christos

nice, Plouf have found a new number-system. 1 to 10 including 20.

Its a long way to the top if you wanna .....CodeGuru

Posted: Thu Jun 06, 2002 6:52 pm
by BackupUser
Restored from previous forum. Originally posted by fred.



Fred - AlphaSND

Posted: Thu Jun 06, 2002 7:25 pm
by BackupUser
Restored from previous forum. Originally posted by plouf.

i guess it was a bug

Christos

Posted: Fri Jun 07, 2002 3:35 pm
by BackupUser
Restored from previous forum. Originally posted by naw.
yes and also
case 1 to 10 ; for all numbers from 1 until 20
as i have asked long time ago :wink:
Christos
If PB supported Unix style Regular Expressions, then this and many other pattern matching problems would be resolved in one go.

eg: select TEST$
case "a" ; .......
case "a|b|b" ; .......
case "a[b|B]" ; ......
case "a[A-z]" ; ......
endselect

- I wonder if there is a Unix style Regular Expressions DLL that could be used in PB? Certainly, there are numerous implementations of vi, bash, sed etc...

Posted: Fri Jun 07, 2002 5:15 pm
by BackupUser
Restored from previous forum. Originally posted by fweil.

You suppose it would solve in one go ...

But it won't.

It will give you an easier way to describe your problem at the PB level. But the compiler will have to translate this in a step by step process which will not be better at the execution level.

I practiced Fortran for years too and this language proposed such tools to build skip tables which were faster, but the multicase will not go faster I believe.

Anyway, if we get such multicase feature it will make the high level design easier to code.

...

Francois Weil
14, rue Douer
F64100 Bayonne

Posted: Fri Jun 07, 2002 7:22 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> if we get such multicase feature it will make the high level design easier to code.

Don't forget that the ElseIf command can simulate multi-Case for the time being:

Code: Select all

If value=1 or value=3 or value=4
  ; code for 1, 3, 4.
ElseIf value=2 or value=5 or value=6
  ; code for 2, 5, 6.
ElseIf value>6 and value<11
  ; code for 7-10.
EndIf

PB - Registered PureBasic Coder

Edited by - PB on 07 June 2002 20:37:19

Posted: Fri Jun 21, 2002 5:26 pm
by BackupUser
Restored from previous forum. Originally posted by Branston.

Could these variants be included in this useful command?

CASE > d ; relational
CASE d TO 99 ; range d to 99 inclusive
CASE 25, d ; two equality tests; equal to 25 or equal to d?
CASE 25 TO 99,14 ;combination of range and equality

Posted: Mon Jun 24, 2002 7:46 am
by BackupUser
Restored from previous forum. Originally posted by bluez.

i support branston's definition, it's the same as gfabasic :)


... this copy of me has been unregistered for 36 years (no spam please)