View previous topic :: View next topic |
Author |
Message |
JRoza Contributor
Joined: 17 Aug 2003 Posts: 182 Location: Netherlands
|
Posted: Sun Jan 30, 2005 10:20 pm Post subject: SELECT CASE command in VDS6? |
|
|
Jules,
Will VDS6 also contain a command like:
SELECT CASE %D
CASE 1
do something
CASE 2
do something else
CASE 3
..........
OTHERWISE
..........
END
This would sure be an asset to produce more tidy coding than a number of nested IFs.
Jan |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Jan 31, 2005 12:21 am Post subject: |
|
|
Jan,
This has been discussed before. I really doubt that Jules will add a Select Case since there is already a If ElsIf Else End which basicly does the same exact thing as a Select Case and IMHO is just as readable. _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Mon Jan 31, 2005 12:29 am Post subject: |
|
|
I think dragonsphere's prolly right - and a SWITCH/CASE
(or whatever) would prolly require another type of "END"
(similiar to "WHILE" using "WEND").
Otherwise the whole IF/ELSE/ELSIF/END routines would
prolly have to be re-written.
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
JRoza Contributor
Joined: 17 Aug 2003 Posts: 182 Location: Netherlands
|
Posted: Mon Jan 31, 2005 1:08 am Post subject: |
|
|
No other commands have to be rewritten, it's just a new command added to the VDS syntax.
I know I can do the same with the IF command, just think a SWITCH/CASE construction is more readable.
I've lived without it in VDS until now and I'll survive if it's not added but I still think coding would be more readable if you have a several levels deep IF command and could use a SWITCH/CASE instead. |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Mon Jan 31, 2005 1:21 am Post subject: |
|
|
Ya do realize that ELSIFs aren't nested any more
than CASE statements would be?
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
JRoza Contributor
Joined: 17 Aug 2003 Posts: 182 Location: Netherlands
|
Posted: Mon Jan 31, 2005 2:04 am Post subject: |
|
|
Looking again in the VDS helpfile you are right
I'm so used to
IF ...
...
ELSE
...
END
that I thought the ELSIF needed as may ENDs (and indentings) as it had IFs but looking at
IF ...
...
ELSIF ...
...
ELSIF ...
...
ELSE
...
END
it sure looks a lot like the SWITCH/CASE I had in mind.
Well at least it made for some nice conversation
I'm off to bed (it's after 3 at night over here)
See ya tomorrow! |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Mon Jan 31, 2005 8:07 am Post subject: |
|
|
from memory, didn't someone put together a dll or a dsu with the SELECT CASE thingy in it?
serge _________________
|
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Mon Jan 31, 2005 9:03 am Post subject: |
|
|
SELECT CASE %D = GOTO %D isn't it?
I think the only change that would be required to provide this full functionality is to provide the option to specify another label to use if %D doesn't exist, which at the moment you need to use OPTION ERRORTRAP to handle.
GOTO <label>, <label_if_not_exist> _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
Back to top |
|
|
|