Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / [SOLVED] How can I make variables in a loop?

Author
Message
swichherddhhhh
2
Years of Service
User Offline
Joined: 30th Nov 2021
Location:
Posted: 30th Nov 2021 03:28
I'm trying to make a loop and use variables, basically have variables made/called on using the value the loop is on.
What I'm trying to do:

for x = 1 to 5
thing [number] = 5 // a variable should be made each time this runs through, the first time creating the variable named thing1, then thing2, and so on
next x

The author of this post has marked a post as an answer.

Go to answer

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 30th Nov 2021 03:49
This post has been marked by the post author as the answer.
do you want them all to = 5?

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 30th Nov 2021 06:08
try this, just for fun

Bored of the Rings
User Banned
Posted: 30th Nov 2021 10:28
you can't make physical variables in a loop i.e. thing1=5, thing2=5, thing3=5 unless you want to change those values for each loop iteration , but yes you can do what the other guys have done and have array thing[1]=5 thing[2]=5 etc. In SAS I can and macros etc, it's great for that as it's an analysis language., but not in AppGameKit or most basic languages
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Login to post a reply

Server time is: 2024-04-19 11:12:07
Your offset time is: 2024-04-19 11:12:07