The following warnings occurred:
Warning [2] Undefined array key 0 - Line: 1677 - File: showthread.php PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/showthread.php 1677 errorHandler->error_callback
/showthread.php 916 buildtree




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
array bounds must be constant
#2
Unfortunately this is not (yet) supported. What you're asking is a DYNAMIC ARRAY. Sad This is a feature planned for 1.2.8 (or higher). Dynamic array are a bit trickier, slower and might take a little more memory, but on the other hand are more powerful and allow redimension during runtime. Meanwhile, you can create an array with a MAXPERSONS size (e.g. 20), and use a variable to store the real number of persons:
Code:
CONST MaxPersons As Ubyte = 20 DIM a(MaxPersons) As Ubyte LET numPersons = 10 : REM number of persons by now... FOR i = 1 TO numPersons LET a(i) = RND * 10 NEXT i
And yes, you will allocate 10 unused positions.
DYNAMIC Arrays are planned for the next release, please, be patient.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)