aldweb

Close I. aldweb

Close II. PC Freeware

Close III. Palm Freeware

Close IV. Palm Shareware

Close V. iziBasic Palm

Close VI. Palm Knowledge

Close VII. Pocket Computer

Close VIII. miniPortail

Special !



Mobile version of
the aldweb Site

m.aldweb.com


Neither French, nor English?

Try one of these flags then:
[de] [es] [it] [pt]
Search




Weather / Spam / www

Lyon Weather


aldweb against spam


Newsletter
To receive news about this website, consider subscribing to our Newsletter.
Subscribe
Unsubscribe
298 Subscribers
Family's web sites

Webmaster - Infos
Friends News
Visits

   visitors

   visitors online

Poll
What do you think of the new design of the aldweb Site?
 
Great !
Beautiful
Average
So ugly...
Results
forum.gifForum - iziBasic - Topic #1589

Forum - Forum
iziBasic - iziBasic


Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257

active  Topic # 1589  I need to know about arrays :(

20/10/2007 @ 22:43
by Nate Weil

Anonymous



Please someone just tell me how to initialize an array, like for instance test(1000) and to keep things simple, how to print from one of those, like print test(2534)
Thanks!
I need this for civ, or it won't even get started :D
  Post an answer  Top

[]   

StartPrevious [ 1 2 ] NextEnd

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 1
--------
20/10/2007 @ 23:39
by Tuka

Anonymous

visitor
Hello Nate,

From User Manual
There are 2 arrays defined in iziBasic: A() and A$().
At runtime, both can address all Numbers and text Strings stacks (see Appendix #8).
A-Z variables are also addressed with A(1)-A(26)
DIM A(n)
At design time, DIM A(n) reserves some space in the Numbers stack in addition to the A-Z variables
Notes:
- n>26 and n<=FRE(4) (see the MINOSVERSION compiling directive and appendix #8). You will have to leave some space in the upper stack for all other numerical assignments.


TEST() is not usable.
My palm is Sony CLIE TJ25.
An error was given in DIM A(1026).
An error was given in DIM A(240).
An array variable is too big.

My sample code.
'Arrays.iBAS
{CreatorID "HELO"}
{Version "1.0"}
{PARSER ON}
{CONSOLEFONT OFF}
BEGIN
DIM A(50)
B=100:C=200:Y=300:Z=400
FOR I=27 TO 50
A=RND(100):A(I)=A
NEXT
FOR I=1 TO 50
A=A(I):A$=STR$(A,0)+" ":PRINT A$;
A=I MOD 10:IF A=0 PRINT
NEXT
WAIT
END
  Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 2
--------
21/10/2007 @ 00:17
by Nate Weil

Anonymous

visitor
So an array can't hold more than 50 variables?
I had read the info on variables in the manual, but it didn't seem to make much sense except that you could refer to the 26 letters as A(1), A(2), etc. and that's not what I need.
  Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 3
--------
21/10/2007 @ 01:06
by Tuka

Anonymous

visitor
Hello Nate,

The size of the array variable is different by a device.
DIM A(230) succeeded with my device.
The number stack is not reserved enough.

I use MegaString to solve this problem.
It can store numbers from 0 to 255 if I use 1 character.
It can store numbers from 0 to 65535 if I use 2 characters.
  Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 4
--------
21/10/2007 @ 01:23
by Tuka

Anonymous

visitor
Hello,

I made a mistake.
The size of the number stack changes by {MINOSVERSION t}.

'FRE.iBAS
{CreatorID "HELO"}
{Version "1.0"}
{MINOSVERSION "5.0"}
{PARSER ON}
{CONSOLEFONT OFF}
BEGIN
A=FRE(4)
PRINT A USING 0
WAIT
END
  Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 5
--------
21/10/2007 @ 01:52
by Nate Weil

Anonymous

visitor
what does FRE(4) do?
Thats the only bit I don't understand
Write to Nate Weil   Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 6
--------
21/10/2007 @ 02:06
by JoeV

Anonymous

visitor
Hello Tuka,

That is a clever way to get around the memory limitation.

Nate,

Tuka is right. It depends on your OS version number. In PalmOS 5.0 you have an array size of almost 12,000. Its more like 11,980 because of some overhead needed by IziBasic. Of course, your palm must be able to run OS 5.0. Read the MINOSVERSION directive in the manual.

So if you can run OS 5.0, your code would look like this:

{MINOSVERSION "5.0"}
dim a(11980)
BEGIN
'program here
END

Then to print variable z your program code would contain:

print z
...or...
a=a(26) : print a

And to print any array variable above z you could write:

a=a(1234) : print a
...or...
a=a(11980) : print a
...etc...etc

Print a(1234) is not allowed but you can perform mathematical ops like:

a(1004)=a(1000)*a(1001)/a(1003)

As Tuka said, you cannot do this:

dim test(11980)

All your array variables must be called a(n), where n is a valid number depending on your OS version, such as a(11980).

Hope this clears things up.

JoeV



  Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 7
--------
21/10/2007 @ 02:12
by Tuka

Anonymous

visitor
Hello Nate,

FRE(4) is last free address of Number Stack.
It is not the greatest size of the array variable.
But I think that it is an approximate aim.
  Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 8
--------
21/10/2007 @ 02:21
by Tuka

Anonymous

visitor
Hello JoeV,

Thank you for detailed explanation.
  Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 9
--------
21/10/2007 @ 02:56
by Nate Weil

Anonymous

visitor
ok... so is everything alright with this listing then?

dim a(10000),b(10000)
begin
a=a(59284)
print a
b=b(25934)
print b
end
  Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 10
--------
21/10/2007 @ 03:12
by Tuka

Anonymous

visitor
Hello Nate,

b() is not usable.
We always use A().
A(59284) is too big.

dim a(10000)
begin
a=a(5000)
print a using 0
b=a(2000)
print b using 0
end
  Post an answer  Top
StartPrevious [ 1 2 ] NextEnd
active topic active   closed topic closed   Sticky Sticky   New New message   -   Correct Correct message   Close Close topic   Make sticky Make sticky
[]
Forum Topic  Forum 



 
^ Top ^