> the one thing I DO miss from VB is its case statement which can be a number
> or a string.
>
> i.e. select case myvariable
> case "Hello"
> show_hello
> case "goodbye"
> show_goodbye
> end select.
>
> This has its good and bad points, BUT ofcourse in Delphi it pretty much has
> to me an integer etc.
> Does anyone have any ideas how this could be implemented in Delphi, OR if
> Delphi has a simlilar type of thing....
The best I' can think of is (not for efficiency but for flexibility with
minimal code complexity)...
with TStringList.Create do try
commatext := 'Hello,Goodbye';
case IndexOf(MyVariable) of
0: Show_Hello;
1: Show_Goodbye;
else ;
end;
finally
free;
end;
Note that there is not reason why the delphi compiler could implement
non-ordinal cases as cascaded 'if' statements... It just that the designers
haven't been nice enough to add that feature...
(now if we had a wishlist for that kind of thing ;))
--
Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz