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"

Author
Message
AdamWales
4
Years of Service
User Offline
Joined: 17th Apr 2019
Location:
Posted: 28th Aug 2019 01:11
Hi,
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
endif

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

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
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
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
AdamWales
4
Years of Service
User Offline
Joined: 17th Apr 2019
Location:
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.

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

Login to post a reply

Server time is: 2024-04-16 08:08:37
Your offset time is: 2024-04-16 08:08:37