[futurebasic] Re:How to reinit array

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 1999 : Group Archive : Group : All Groups

From: Robert Covington <t88@...>
Date: Sat, 27 Feb 1999 21:18:52 -0700 (MST)
>> I want to be able to reset all str$ to "" and all elements% to = 0 for
>>each of
>> the 720 reiterations of the array without a FOR - NEXT loop. Can I?
>
>Try:
>
>DEF LONGBLOCKFILL (@myArray(0),721*_myRec,0)
>
>joe k


Or just use CLEAR...if you don't mind having all your globals wiped.


'CLEAR Demo, Robert Covington

'CLEAR
'From Help File

'Sets all global and main program variables to zero or null.
' A CLEAR is done automatically whenever a program starts.
'Variables defined in a LOCAL FN are not affected.  See CLEAR

DIM RECORD myRec
DIM 30 myName$
DIM 15 someInfo$
DIM 15 moreInfo$
DIM element1%
DIM element2%
DIM element3%
DIM END RECORD.myRec
DIM myArray.myRec (720)
END GLOBALS

WINDOW 1

FOR j=1 TO 400                                    ' Load the array a bit
myArray.myName$(j)="Test"+STR$(j)
myArray.element1%(j)=j
NEXT j

FOR j=1 TO 10                                     ' Test the contents

PRINT "Element# :";
PRINT myArray.element1%(j);
PRINT "Name: ";
PRINT myArray.myName$(j)
NEXT j


CLEAR                                             ' Kill the contents

PRINT                                             'formatting
PRINT "I can see clearly now, the pain is gone."  ' song lyric corruption
PRINT                                             'formatting

DELAY 600                                         ' small delay

FOR j=1 TO 10                                     ' Contents now reset to
zero, lookee.
PRINT myArray.myName$(j);
PRINT "Name"+STR$(j)+" Cleared ";
PRINT "Element is now: ";
PRINT myArray.element1%(j)
NEXT j

STOP