Declaring multiple variables
Author |
Message |
timtimpei
|
Posted: Thu Jan 10, 2008 3:57 pm Post subject: Declaring multiple variables |
|
|
I'm making a program that needs a lot of variables of the same type (int). Is there any way to declare multiple variables (maybe by using if and else, loop, etc) so that i don't have to write out everysingle one of them one by one? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Saad
![](http://compsci.ca/v3/uploads/user_avatars/182387547249e7ebb91fb8a.png)
|
Posted: Thu Jan 10, 2008 3:59 pm Post subject: Re: Declaring multiple variables |
|
|
Arrays are your solution |
|
|
|
|
![](images/spacer.gif) |
timtimpei
|
Posted: Thu Jan 10, 2008 4:09 pm Post subject: Declaring multiple variables |
|
|
Sorry, my question wasn't really clear. Right now i need to upload pictures like this:
const welcomebg : int := Pic.FileNew ("UltimateEarth.jpg")
I can write this for just a few pictures, but i have tons of pictures to upload, so is there any way to make this easier (or quicker)? |
|
|
|
|
![](images/spacer.gif) |
Zampano
![](http://compsci.ca/v3/uploads/user_avatars/123384421747e86c6cddac1.gif)
|
Posted: Thu Jan 10, 2008 4:12 pm Post subject: Re: Declaring multiple variables |
|
|
Well, if it's line that you're concerned about, you can use the init procedure to initialize an array of all the file names of your pictures in an array without using too many lines. Then, use a for loop to Pic.FileNew them |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Thu Jan 10, 2008 4:23 pm Post subject: RE:Declaring multiple variables |
|
|
you can read the contents of a file directory, and load every file from there, into an array. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
|
|