Recent

Author Topic: Enumerated Type problem(Solved)  (Read 600 times)

JLWest

  • Hero Member
  • *****
  • Posts: 1054
Enumerated Type problem(Solved)
« on: September 22, 2021, 06:10:12 am »
I get an error on Line 12. unit1.pas(962,27) Error: Label used but not defined "ARGUMENTS"

ARGUMENTS is defined as the first enumerated type in headers.

I don't understand.

Help please


Code: Pascal  [Select][+][-]
  1. Headers = ( Arguments, FunctionResult, Description,
  2.               SeeAlso, TheLast, NilHearer );
  3.  
  4.  
  5.  function TForm1.NextHeader( AHEADER : Headers; AARG,AFUNRESULT,ADESC,ASEE : Boolean ) : Headers;
  6.    Var
  7.    sHeader : Headers;
  8.    NHeader : Headers = TheLast;
  9.   begin
  10.  
  11.        for sHeader := Arguments to NilHeader do begin
  12.  
  13.          Arguments      : begin
  14.                            if sHeader = AHeader then Continue;
  15.                            if AARG then NHeader :=  FunctionResult;
  16.                           end;
  17.  
  18.          FunctionResult : begin
  19.                            if sHeader = AHeader then Continue;
  20.                            if AFUNRESULT then NHeader :=  FunctionResult;
  21.                           end;
  22.  
  23.          Description    : begin
  24.                            if sHeader = AHeader then Continue;
  25.                            if ADESC then NHeader :=  Description;
  26.                           end;
  27.  
  28.          SeeAlso        : begin
  29.                            if sHeader = AHeader then Continue;
  30.                            if ASEE then NHeader :=  SeeAlso;
  31.                           end;
  32.  
  33.          TheLast        : NHeader :=  TheLast;
  34.  
  35.          NilHeader      : NHeader :=  NilHeader;
  36.  
  37.        end;
  38.         Result := NHeader;
  39.    end;
« Last Edit: September 22, 2021, 08:08:36 am by JLWest »
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

af0815

  • Hero Member
  • *****
  • Posts: 716
Re: Enumerated Type problem
« Reply #1 on: September 22, 2021, 07:12:15 am »
It looks you have mixed the syntax of 'if' and ' case' statement.

https://wiki.freepascal.org/Case
https://wiki.freepascal.org/IF
regards
Andreas

JLWest

  • Hero Member
  • *****
  • Posts: 1054
Re: Enumerated Type problem
« Reply #2 on: September 22, 2021, 07:38:06 am »
Thanks but I still don't get it.

 The if's have nothing to do with case statement.
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

bytebites

  • Sr. Member
  • ****
  • Posts: 416
Re: Enumerated Type problem
« Reply #3 on: September 22, 2021, 07:47:49 am »
case missing

Code: Pascal  [Select][+][-]
  1.        for sHeader := Arguments to NilHeader do begin
  2.          case sheader of   //<--------
  3.          Arguments      : begin

JLWest

  • Hero Member
  • *****
  • Posts: 1054
Re: Enumerated Type problem
« Reply #4 on: September 22, 2021, 08:08:15 am »
Yea, Thanks Got it.
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

 

TinyPortal © 2005-2018