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] Error Message : Unexpected Token "as"

Years of Service
User Offline
Joined: 17th Apr 2019
Posted: 28th Aug 2019 01:11
Am new to AGK2 (Tier1) but am an experienced C#/VB.NET coder. I am confused as to why I am getting the above error. Code is below... any ideas because i am at a loss

spacing as integer = 0
x as integer = 0
y as integer = 0

// First the horizontal lines
if (numberHorizontalLines > 0)
spacing = round(GFXHeight / numberHorizontalLines)
for y = 0 to GFXHeight step spacing
DrawLine(0,y,GFXWidth,y, linecolour)
next y

The error is showing on the line
spacing = round(GFXHeight / numberHorizontalLines)

For reference the GFXHeight has been defined as a Constant Integer at the top of the file
and numberOfHorizontalLines has been defined as an integer (as the parameter of the function this code is in)

I would be grateful for any pointers as this has me baffled

Many Thanks

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

Go to answer

Retired Moderator
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 28th Aug 2019 01:42
This post has been marked by the post author as the answer.
Ive noticed a few things missing with the code
but below doesn't give errors

fubarpk on Itch...………...
fubarpk on googleplay..
Years of Service
User Offline
Joined: 17th Apr 2019
Posted: 28th Aug 2019 15:29
Many Many Thanks.

I did have a constant set for GFXHeight, but set it "as integer" which explains the error. Quite why the compiler didnt flag it at that point i dont know.

I think its getting used to the slightly different basic than I am used to. Much appreciated the quick reply.

AGK Developer
Years of Service
User Offline
Joined: 16th Sep 2015
Location: US

Login to post a reply

Server time is: 2020-08-12 07:58:30
Your offset time is: 2020-08-12 07:58:30