|
Post by jarychk on Jul 10, 2022 22:28:24 GMT
I wanted to ask for help, but I found enough advice to finish the main part myself. There were a small number of videos on YouTube, but following any example code was confusing. So much going up & down with indices and loop variables.
The basic part which does the task here is short and may (or may not) be easy enough to study and to follow.
This example program lets the user REMOVE one array element at a time.
'learn the deletion operation for an array element or "record" 'july 10, 2022
dim ra$(30) n=10 'beginning size of array elements count ra$(1)="A" ra$(2)="B" ra$(3)="C" ra$(4)="D" ra$(5)="E" ra$(6)="F" ra$(7)="Z" ra$(8)="G" ra$(9)="H" ra$(10)="I"
[goagain] for h=1 to n print h,ra$(h) next h print print "Element at which index to delete? " : input k
K=int(k) if K<1 or ans>n then END cls print "LET's GO!" : input dumy
'BEGIN DELETION OP HERE for i=K to n-1 let ra$(i)=ra$(i+1) next i
print "Now count of elements should be ";n-1 ra$(n)="" let n=n-1
'CHECK THE RESULT
goto [goagain]
END (I still no not know why all the extra line spaces. I did not write the program with the extra line spaces.)
A few style imperfections but as this resulting sample is helpful for me, it may be helpful for others.
EDIT: I might have dropped a line of code during the re-editing attempt.
|
|
|
Post by tsh73 on Jul 11, 2022 6:20:52 GMT
Please tell your OS and browser version
|
|
|
Post by Rod on Jul 11, 2022 7:07:09 GMT
When you post code to this forum it can add spaces. It is a bug of the forum. To avoid it do not use the preview pane when posting the code. There are two tabs at lower left of the window you are posting the code into. Be sure preview is not selected.
Click on BBCode before you post the code. Preview should be dark and BBCode white. Only then will the forum show the code as posted.
|
|
|
Post by jarychk on Jul 11, 2022 7:27:49 GMT
Please tell your OS and browser version Most of the time and for my recent posts, Windows 10, and Google Chrome Browser, incognito mode
|
|
|
Post by tsh73 on Jul 11, 2022 8:56:17 GMT
I completely forgot that Rod said! test code? from preview mode, pasting from JB - new line doubles (interesting that if I type code in browser, new line does not double)
open "pianomencsv.txt" for append as #nu
'print #nu,another$
'print #nu,whborn$
'print #nu,whyear$
print #nu, "" 'new line
print #nu,another$;",";whborn$;",";whyear$; 'line delimited with ",", no new line
close #nu
|
|
|
Post by tsh73 on Jul 11, 2022 8:58:47 GMT
quick reply report - defaults to BBcode, not preview - or it's just me?
open "pianomencsv.txt" for append as #nu 'print #nu,another$ 'print #nu,whborn$ 'print #nu,whyear$ print #nu, "" 'new line print #nu,another$;",";whborn$;",";whyear$; 'line delimited with ",", no new line close #nu
|
|
|
Post by tsh73 on Jul 11, 2022 9:03:14 GMT
I happened to set it up to BBCode by default: profile/edit profile/settings posting default - set to BBCode That's why I don't even remember such problem exists!
|
|
|
Post by jarychk on Jul 11, 2022 9:05:43 GMT
I completely forgot that Rod said! test code open "pianomencsv.txt" for append as #nu
'print #nu,another$
'print #nu,whborn$
'print #nu,whyear$
print #nu, "" 'new line
print #nu,another$;",";whborn$;",";whyear$; 'line delimited with ",", no new line
close #nu
This quoted post looks like it would go better into the other topic, in which I brought up the situation with append?
|
|
|
Post by tsh73 on Jul 11, 2022 9:23:44 GMT
It is on topic about double spacing This code just happened to be already selected in my copy of JB Probably "old mcDonald had a farm" would do too, but do you have it handy in JB?
So go ahead and try that suggestion, post some piece of code - will if fix double spacing for you?
|
|
|
Post by jarychk on Jul 11, 2022 10:20:11 GMT
It is on topic about double spacing This code just happened to be already selected in my copy of JB Probably "old mcDonald had a farm" would do too, but do you have it handy in JB? So go ahead and try that suggestion, post some piece of code - will if fix double spacing for you? I may test such posting in a separate board on the JB forum.
|
|