We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
random in a array
#1
the line of code 

lunghezza = Array.GetItemCount(contenuto) ' mi da' lunghezza = 0 ERRORE

give me a lunghezza equal zero = 0
Reply
#2
Hi.  Shy

Could you explain in more detail what "contenuto" is equal to in this line of code?
[-] The following 1 user Likes AbsoluteBeginner's post:
  • litdev
Reply
#3
contenuto = File.ReadContents(filePath)

contenuto = A
                   B
                   C

lunghezza = Array.GetItemCount(contenuto)

lunghezza = 0
Reply
#4
File.ReadContents() doesn't automatically put each line in an array element.
If you put a TextWindow.WriteLine(contenuto) after the ReadContents you see all the lines.

If there are no empty lines in the file you can do something like:

for i=1 to 999 ' ' if there are not more then 999 lines in the file
contenuto[i]=File.ReadLine(filepath,i)
if contenuto[i]="" then
i=1000
else
lunghezza=i
endif
endfor
[-] The following 1 user Likes WhTurner's post:
  • litdev
Reply


Forum Jump:


Users browsing this thread: litdev, 3 Guest(s)