1. arrays/sequences in DOS version

Hi everyone!

I am brand new to Euphoria and want to port code from QuickBasic for 
DOS.

One thing I am unable to determine is the equivalent sequence procedure 
for a multi-dimemsional array and how to fill it with variables.

e.g.

dim somearray(2,2)
for x=1 to 2
  for y=1 to 2
    somearray(x,y)=x*y
  next y
next x

I hope I can build really large arrays/sequences (up to 4 dimensions)
without encountering the memory limitations of QuickBasic.

Many thanks.  Looking very much forward to using this great language.

Darceman

new topic     » topic index » view message » categorize

2. Re: arrays/sequences in DOS version

sequence  somearray, elem1, elem2 --must declare variables before use
somearray = {{0,0},{0,0}} --initialize somearray as a two element sequence
for x = 1 to 2 do
    for y = 1 to 2 do
        somearray[x][y] = x*y
        printf(1,"somearray[%d][%d] = %d\n",{x,y,somearray[x][y]}) 
--print value of each element
    end for
end for
while get_key() != 'n' do --keep console window open
end while

darceman wrote:

>
>Hi everyone!
>
>I am brand new to Euphoria and want to port code from QuickBasic for 
>DOS.
>
>One thing I am unable to determine is the equivalent sequence procedure 
>for a multi-dimemsional array and how to fill it with variables.
>
>e.g.
>
>dim somearray(2,2)
>for x=1 to 2
>  for y=1 to 2
>    somearray(x,y)=x*y
>  next y
>next x
>
>I hope I can build really large arrays/sequences (up to 4 dimensions)
>without encountering the memory limitations of QuickBasic.
>
>Many thanks.  Looking very much forward to using this great language.
>
>Darceman
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu