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 / Declaring local variable?

Author
Message
bigtunacan
9
Years of Service
User Offline
Joined: 24th Jul 2015
Location:
Posted: 21st Feb 2016 06:21
If I want a variable to be global I denote it with global.



If I don't denote it as global it is automatically local, but this does not work with
.

How do I declare a variable as local when using #option_explicit?
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 21st Feb 2016 07:38
You will need to specify the data type, such as:

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 23rd Feb 2016 16:03
or
local foo as integer
should work in agk v2
AGK (Steam) V2.0.16 : Windows 10 Pro 64 Bit : AMD (15.30.1025) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 23rd Feb 2016 23:30 Edited at: 23rd Feb 2016 23:31
Or just use it...

bigtunacan
9
Years of Service
User Offline
Joined: 24th Jul 2015
Location:
Posted: 24th Feb 2016 01:26
JLMoondog,

You seem to have missed that I was discussing this only with respect to using
in which case it must be declared before you use it.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 24th Feb 2016 06:27
#option_explicit works quite well for me. can you give a specific example where it is not working. maybe some code and the error message or lack therof?

Sign up for NaGaCreMo!
bigtunacan
9
Years of Service
User Offline
Joined: 24th Jul 2015
Location:
Posted: 24th Feb 2016 17:38
It works fine using xCept and Markus' advice. I just couldn't find appropriate documentation at the time.

Login to post a reply

Server time is: 2024-11-17 04:08:13
Your offset time is: 2024-11-17 04:08:13