Op Thu, 6 Nov 2008, schreef Graeme Geldenhuys:
On Thu, Nov 6, 2008 at 11:57 AM, Henry Vermaak <[EMAIL PROTECTED]> wrote:
1) 'case' by string and type http://prismwiki.codegear.com/en/Case_(keyword)
Did you not know that this is supported in FPC (for some time now).
;-) And it's not just limited to ordinal or string types.... I'll
share my code. We have been using this for some time in our projects.
:-)
Example usage:
no, fpc only supports case of ordinal, enum and char types. your
example just shows the most common way to get around that.
I know that! You clearly missed the smiley face. :-)
Another not-exact solution, supported in FPC since version 2.3 is:
type colour=(red,green,blue);
var s:string;
c:colour;
begin
val(s,c);
case c of:
red:
writeln('s contained "red"');
green:
writeln('s contained "green"');
blue:
writeln('s contained "blue"');
end;
end;
Daniël
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel