Mintoris Forum

Author Topic: Array size  (Read 2895 times)

hoyoyo80

  • Full Member
  • ***
  • Posts: 66
Array size
« on: May 02, 2016, 05:03 AM »
Hi…quick question. Im using dir$() command to get all files into array. After fetching it, how do i get to know the size of that array‥

Thanks

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: Array size
« Reply #1 on: May 02, 2016, 05:11 AM »
files$() = Dir$()

n() = GetDim(files$())
For i = 0 to n(1)
  print files$(i)
next


hoyoyo80

  • Full Member
  • ***
  • Posts: 66
Re: Array size
« Reply #2 on: May 03, 2016, 09:28 AM »
Thanks Chuck‥

im put 3 files in my test directory. My n(1) return 2 is this right?

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: Array size
« Reply #3 on: May 03, 2016, 04:31 PM »
Yes, 0, 1, 2  Three items

hoyoyo80

  • Full Member
  • ***
  • Posts: 66
Re: Array size
« Reply #4 on: May 06, 2016, 01:53 PM »
Ok thanks‥thats clear it out;)

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: Array size
« Reply #5 on: May 20, 2016, 06:57 PM »
Best to think of the value as the max index instead of array size.