Skip to content

LEN seems linked to issue with array referencing #147

@circular

Description

@circular

Hi, I'm enjoying SmallBASIC and wanted to share this issue in case it's relevant.

Version: SmallBasic FLTK 12.23, 7 Sep 2021
OS: Linux / AppImage

As an example, running the example here, an error is thrown:

https://smallbasic.github.io/pages/features.html

Code:

tload "/etc/passwd", buffer
for row in buffer
  split row, ":", fields()
  if (len(fields) > 0) then
    local user
    user.name = fields(0)
    user.passwd = fields(1)
    user.userId = fields(2)
    user.groupId = fields(3)
    users << user
  fi
next row
? users
Error: RTE-ERROR AT untitled.bas:7 *
Description:
Array: Index '1' out of range. (Max = 1)

(Note: I changed the HTML codes for less-than, to << in the code to get it to work)

As a workaround, I changed LEN to UBOUND and the code worked fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions