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 Studio Chat / [SOLVED] Is there a simular Command in AGK Like "Sql IN"

Author
Message
DannyD
4
Years of Service
User Offline
Joined: 29th Aug 2017
Location:
Posted: 27th Nov 2020 02:33
Hi Guys
I try to search but couldn't find anything or my search parameters are completely wrong

In SQL there is an "IN" function
instead of using

you can use


Is something like this available in AGK/S?

I have an APP with a bunch of IF statements and looking for a shorter/cleaner way of reorganizing my code

Thanks

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

Go to answer

janbo
12
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 27th Nov 2020 22:07
If it's only strings you could try integer FindString( str, findStr ).
If not you could put your stuff into an array and try the Array.find() method. (note this onlly searches over the first element in a type)
If that also doesn't work for you I suggest you to create your own little library with usefull functions
DannyD
4
Years of Service
User Offline
Joined: 29th Aug 2017
Location:
Posted: 28th Nov 2020 01:58
Thanks Janbo. Thought about using arrays.... just hope there was other options maybe
huggy70
1
Years of Service
User Offline
Joined: 11th Jun 2020
Location:
Posted: 28th Nov 2020 09:09
You can use the Select / EndSelect with strings also. Results in a much nicer code structure:

From Help:

select state
case 1
print ( "state is 1" )
endcase
case 2
print ( "state is 2" )
endcase
endselect
blink0k
Moderator
8
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 28th Nov 2020 20:31
This post has been marked by the post author as the answer.
you could also say;
DannyD
4
Years of Service
User Offline
Joined: 29th Aug 2017
Location:
Posted: 30th Nov 2020 10:01
Your the man @blink0k. Exactly what i need

Login to post a reply

Server time is: 2021-09-19 21:10:18
Your offset time is: 2021-09-19 21:10:18