Forum > Suggestions

CASE statement with strings.

<< < (2/7) > >>

Leledumbo:

--- Quote ---btw the FPC 2.6.0 reference guide (pdf) makes no mention of this...
--- End quote ---
Please report a missing documentation, it's documented somewhere AFAIR (but I can't find it now).

daveinhull:
Hi,

I'm just trying to use a case statement with string cases and I'm getting an error.

I'm using a nightly build version FPC Version 3.1.1 (2015/04/16) SVN Revision 48706.

--- Code: ---       
Case sField Of
        'Final_Invoice' :
           sFilterString := sFilterString + sField + '=''' + comboFilterDropdown.KeyValue + '''' ;
end;

--- End code ---

sField is declared as a string and the case elements are strings, but the error says that there is a mismatch, see attachment.

This discussion indicates that strings were allowed in V2.6.0, but unless I'm doing something very silly, I can't get it to compile.

Any help would be appreciated.

Thanks
Dave

Blaazen:
Hello, I guess you use

--- Code: ---{$mode delphi}
--- End code ---

It works here with FPC 3.1.1 and

--- Code: ---{$mode objfpc}
--- End code ---

Leledumbo:

--- Quote from: Blaazen on April 28, 2015, 01:45:19 am ---Hello, I guess you use

--- Code: ---{$mode delphi}
--- End code ---

It works here with FPC 3.1.1 and

--- Code: ---{$mode objfpc}
--- End code ---

--- End quote ---
It works in FPC/ObjFPC mode only. Delphi, TP, MacPas and ISO mode doesn't support it for compatibility.

daveinhull:
Thanks guys,

That sorted it  :D

Dave

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version