It says there is an error with the if statement and it will not print the 9 can u help me where i went wrong

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

extends Node

var number = 6
const boy = 5
func _ready():
if Input. is_action_pressed(up):
if number = 5 or boy = 5
print(var = 9)

:bust_in_silhouette: Reply From: Gluon

There are a few problems above, you have no : at the end of an if statement, you have no quotations on the is action pressed and you should be getting an error message saying unexpected assign. If you use one equals it means assign this to the variable if you want to ask if something is equal to a thing you need two equals signs like this

var number = 6
const boy = 5

 func ready():
    if input.is_action_pressed("up"):
        if number == 5 or boy == 5:
:bust_in_silhouette: Reply From: Mazen

the is_action_pressed method is written like this and u should pass a string argument to it meaning u should rite “up” not up