[Coco] Using the Basic09 type statement. CORRECTION

coco at jechar.ca coco at jechar.ca
Sun Apr 4 10:01:40 EDT 2021


Ignore original code. Equal signe were missing from three lines.
Program still has issues though.

Revised Code

PROCEDURE ttype
  0000
  0001      TYPE LINE=sline:STRING[17]
  0011      TYPE HEADER=head:STRING[21]
  0021 ERR     TYPE SCREEN=head:HEADER;sline:LINE[6]
  0049      (* Trying to say that type SCREEN is a HEDER followed by an 
array of 6 LINEs s each consisting of up to 17 characters. *)
  00C2
  00C3      DIM aline:LINE
  00CC      DIM ahead:HEADER
  00D5      DIM apage:PAGE
  00DE
  00DF      apage.ahead="This is the Header field of the page"
  010E      apage.aline(1)="This is line ONE of the page."
  0138      apage.aline(2)="This is line TWO of the page."
  0162      apage.aline(3)="This is line THREE of the page."
  018E
  018F      PRINT apage
  0194
  0195      END
00DD ERROR #024
00E6 ERROR #066
010D ERROR #071
0114 ERROR #065
0117 ERROR #066
0137 ERROR #071
013E ERROR #065
0141 ERROR #066
0161 ERROR #071
0168 ERROR #065
016B ERROR #066
018D ERROR #071



On 2021-04-04 10:14, coco at jechar.ca wrote:
> I am trying to create a type that consists of a field that is a 21
> character string
> followed by a field that is an array of 17 character strings. I read
> some documentation and am not sure it is even possible this was my
> attempt and it's errors,
> 
> PROCEDURE ttype
>  0000
>  0001      TYPE LINE=sline:STRING[17]
>  0011      TYPE HEADER=head:STRING[21]
>  0021 ERR     TYPE SCREEN=head:HEADER;sline:LINE[6]
>  0049      (* Trying to say that type SCREEN is a HEDER followed by an
> array of 6 LINEs s each consisting of up to 17 characters. *)
>  00C2
>  00C3      DIM aline:LINE
>  00CC      DIM ahead:HEADER
>  00D5      DIM apage:PAGE
>  00DE
>  00DF      apage.ahead="This is the Header field of the page"
>  010E ERR     apage.aline(1) "This is line ONE of the page."
>  013F ERR     apage.aline(2) "This is line TWO of the page."
>  0170 ERR     apage.aline(3) "This is line THREE of the page."
>  01A3
>  01A4      PRINT apage
>  01A9
>  01AA      END
> 00DD ERROR #024
> 00E6 ERROR #066
> 010D ERROR #071
> 
> Can this be fixed or am I trying to do the impossible.
> 
> Charlie


More information about the Coco mailing list