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.

AppGameKit Classic Chat / Need help with arrays

Author
Message
Game_Code_here
2
Years of Service
Recently Online
Joined: 2nd Jun 2020
Location:
Posted: 27th Oct 2022 02:17 Edited at: 27th Oct 2022 02:18
Hi, been a long time and i am a little ruty from my rest.

I have a set of ballons I am working on as a learning lesson from the books.

Im taking a lot I have read on and my array will not work. Can some one tell me what i am doing wrong? I understand arrays and know how to use them and this is why I am lost. I guess i do not remember something.

Anyhow, this does not work . the error is "id" Need to be followed by what ever,so on and so forth.

blink0k
Moderator
9
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 27th Oct 2022 03:05 Edited at: 27th Oct 2022 03:07
With arrays of types I will define a single type and the array.

As i loop i populate the single type and then insert it into the array.

When i define types a begin the name with a "t". That way I can differentiate between data names and type names

I changed a couple things there to make it a bit more readable.



Good luck!
Game_Code_here
2
Years of Service
Recently Online
Joined: 2nd Jun 2020
Location:
Posted: 27th Oct 2022 04:32 Edited at: 27th Oct 2022 06:38
Thank[u] you for the help I see what i did in the first place.

Here is my whole program to show as a learning example i created.

LOL, EDIT, I misspelled Balloons with Ballon, well, at least the program does not care lol.

blink0k
Moderator
9
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 27th Oct 2022 07:45
Looks good.
Maybe have a look at functions as well
Game_Code_here
2
Years of Service
Recently Online
Joined: 2nd Jun 2020
Location:
Posted: 27th Oct 2022 08:53 Edited at: 27th Oct 2022 08:54
@blink0k

Yes, Right now i am learning how to use the else command to nest information correctly.

When I get to functions I will probebly need some help with something lol.

I know a lot about functions but not everything and there is a lot to learn so this is fun for me to learn and reading the books is making me think wow, there is a lot i have never done correctly.

Thank you for the help.
fubarpk
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 23rd Nov 2022 12:40
functions are handy
for example i made this function if you want to check if an integer equals another integer as it was for print purposes it returned the string
used like print(nottrue(1,2)) prints "True



maybe not very handy a function in general but useful in a program I'm working on
PK
Steve Ancell
16
Years of Service
User Offline
Joined: 16th Feb 2006
Location: Brighton, East Sussex, UK
Posted: 24th Nov 2022 15:44
@fubarpk
Your function will always return a string that contains True, it needs to be something more like this.

blink0k
Moderator
9
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 24th Nov 2022 19:55 Edited at: 25th Nov 2022 01:32
Quote: "Your function will always return a string that contains True, it needs to be something more like this."


Not quite.

it will return "False" if this condition is true

Quote: "if a=b then exitfunction "False""
Steve Ancell
16
Years of Service
User Offline
Joined: 16th Feb 2006
Location: Brighton, East Sussex, UK
Posted: 24th Nov 2022 23:17
@blinkOk

I failed to notice the use of ExitFunction, my bad!

Login to post a reply

Server time is: 2022-12-04 02:27:35
Your offset time is: 2022-12-04 02:27:35