Liberty BASIC Community Forum
« Arrays »

Welcome Guest. Please Login or Register.
Sep 20th, 2017, 09:53am


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Arrays  (Read 133 times)
Dan Teel
Guru
ImageImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 1130
xx Arrays
« Thread started on: Jun 27th, 2017, 02:20am »

I'd like to be able to pass an array to a sub/function like so

Code:
dim PeopleAges(100)
dim DogAges(100)

for i=1 to 100
 PeopleAges(i)=i
 DogAges(i)=i*7
next i

call printAges PeopleAges()
call printAges DogAges()

sub printAges ages()
 for i = 1 to 100
   print ages(i)
 next i
end sub
 


This gives the programmer more flexibility. And it would be super nice to have a function that would give me the current size of an array.

Code:
 for i = 1 to arrayLen(PeopleAges)
  print PeopleAges(i)
next i
 


I also wish that you can define the scope of an array, instead of them always being global.
« Last Edit: Jun 27th, 2017, 3:40pm by Dan Teel » User IP Logged

ZPtr.net
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls