How to tell if a value is different from another?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By 9BitStrider
:warning: Old Version Published before Godot 3 was released.
func _on_MegaMan_finished():
if anim == "lilstep" and direction <> 0:
	anim = "run"
	player.play(anim)

The above code gives me the following error:

error(71,38): Error parsing expression, misplaced: '>'

I’m not too familiar with the inner workings with GDscript or Python yet. Is there another expression to tell if my direction value is different from 0?

:bust_in_silhouette: Reply From: 9BitStrider

Figured it out. I needed to use != instead of <>. Curse me for going with Clickteam Fusion for all this time. XD

Using != works reliably for strings or integer values.

It does not work reliably for floating point values. In that case you could use something like: if abs(float1-float2)<0.0001:

wombatstampede | 2017-08-04 09:31