Topic : The GFA-Basic Compendium Author : GFA Systemtechnik GmbH Version : GFABasic.HYP v2.98 (12/31/2023) Subject : Documentation/Programming Nodes : 899 Index Size : 28056 HCP-Version : 3 Compiled on : Atari @charset : atarist @lang : @default : Document not found @help : Help @options : +g -i -s +z @width : 75 @hostname : STRNGSRV @hostname : CAB @hostname : HIGHWIRE @hostname : THING View Ref-FileINSERT x(i)=y DELETE x(i) x: name of an array i: iexp y: aexp or sexp, according to variable type of the array With the instruction INSERT an array element can be inserted. With the instruction DELETE an array element can be deleted. INSERT inserts the value of the expression y in the array x() at the position i. All elements of the array which have an index larger than i are shifted up one position. Thus if an element stood at position 3 before, then it will be found at position 4 after the INSERT instruction. The last element of the array is deleted. DELETE removes the i-th element of the array x(). All array elements which have an index larger than i are shifted down one position. The last element of the array is made zero (or a null string with character string arrays). These instructions are highly suitable for the management of lists, in which elements are constantly being inserted or deleted. Examples: DIM x%(5) FOR i%=1 TO 5 x%(i%)=i% NEXT i% INSERT x%(3)=33 FOR i%=0 TO 5 PRINT x%(i%) NEXT i% --> The numbers 0, 1, 2, 33, 3, and 4 are printed on the screen. DIM x%(5) FOR i%=1 TO 5 x%(i%)=i% NEXT i% DELETE x%(3) FOR i%=0 TO 5 PRINT x%(i%) NEXT i% --> The numbers 0, 1, 4, 5, and 0 are printed on the screen. Memo: This works in the editor but not compiled: INSERT a%(j&)=a%(j&+1) Boolean arrays are not supported by these commands.