if Input.is_action_pressed("up"): unexpected token

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By KrishCannot

Hi I’m very new to coding so I chose Godot as I believed it is perfect for beginners. I wrote “if Input.is_action_pressed(“up”):” for a line of code and it appears as an error with the words " Unexpected Token if:" I don’t know if I should be worried about that or not. Please tell me if I have done anything wrong.

Thank you!

Could you please post a screenshot of the line and the warning?

betauer | 2021-02-10 16:53

:bust_in_silhouette: Reply From: Good-Boi McLovin

If I had to guess you are attempting to use this code outside a function to run it from.
So for example:

Func _proccess(Delta): #This here is a function that runs at every frame of your game
 If Input.is_action_pressed(): #if key is pressed. Do thang.

Hopefully this helps. ^-^