Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 12:36 11 May 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : DIM a(1) and OPTION BASE 1

Author Message
andreas

Senior Member

Joined: 07/12/2020
Location: Germany
Posts: 226
Posted: 08:54am 03 Dec 2024
Copy link to clipboard 
Print this post

Hi,

when using OPTION BASE 1 I get an error when writing dim a(1).

[3] Dim a(n)
Error : Dimensions


OPTION BASE 1
n=1
DIM a(n)


If n>1 everything is fine.

I understand that the lowest index in an array is 0 when using OPTION BASE 0 and 1 when using OPTION BASE 1, but why do I need 2 values when using OPTION BASE 1?

I get the problem when reading the value of 'n' from a DATA statement by READ. The program has a DATA statement holding application data and n=1 could be a possible value for 'n'.

WebMite MMBasic RP2350A Edition V6.00.01RC1

-andreas
Edited 2024-12-03 18:57 by andreas
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10067
Posted: 09:19am 03 Dec 2024
Copy link to clipboard 
Print this post

MMBasic doesn't allow single element arrays. I wish it did for reasons such as array multiplication but it doesn't. I don't think this is something that could be easily changed as it is fundamental to the way the variable table is built
 
andreas

Senior Member

Joined: 07/12/2020
Location: Germany
Posts: 226
Posted: 06:16pm 03 Dec 2024
Copy link to clipboard 
Print this post

  matherp said  MMBasic doesn't allow single element arrays. I wish it did for reasons such as array multiplication but it doesn't. I don't think this is something that could be easily changed as it is fundamental to the way the variable table is built


ok - many thanks for answer!

-andreas
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025