Author Topic: LBOUND  (Read 335 times)

Robert

  • Hero Member
  • *****
  • Posts: 555
    • View Profile
LBOUND
« on: July 11, 2020, 08:28:34 PM »
LBOUND function would be useful for determining lower bound of OPTION BASE arrays.

Robert

  • Hero Member
  • *****
  • Posts: 555
    • View Profile
Re: LBOUND
« Reply #1 on: July 11, 2020, 09:14:50 PM »
LBOUND function would be useful for determining lower bound of OPTION BASE arrays.

Never mind ... The non-existent BCX "LBOUND" would always be ZERO no matter what the OPTION BASE may be set to.

Gawd, sometimes I feel so stupid!

Code: [Select]

DIM str1$

OPTION BASE 20

GLOBAL MyStrings$[10]
PRINT UBOUND(MyStrings)

MyStrings$[0] = "A BIG FAT ZERO"

PRINT MyStrings$[0]


Results:

Code: [Select]

 29
A BIG FAT ZERO

« Last Edit: July 11, 2020, 09:44:52 PM by Robert »

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 714
    • View Profile
Re: LBOUND
« Reply #2 on: July 11, 2020, 11:02:07 PM »
I never use it but I think the main value is in setting it to OPTION BASE 1, so that your
array gets one more cell and you get to think in terms of 1 to 10 instep of 0 to 9 ... to wit:

Code: [Select]

option base 1
dim i
dim stuff[10]   ' create 11 cells ... 0 to 10

for i = 1 to 10
  stuff[i] = i
next