Compare a variable in the IF statement

: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.
if yspeed < 700:
	yspeed += GRAVITY

if yspeed < 0 and jump_hold == 0:
	yspeed = 0

Trying to make a Mega Man style jump where the longer you press the jump button, the higher the player can jump. However, the script I’m using for them the player releases jump before they’re at the peak doesn’t seem to work. My guess is having to do with the lower than symbol. I know I should use == during the IF statement to compare a variable, but should I use <= for the yspeed? Or is it something else?

:bust_in_silhouette: Reply From: ingo_nikot

u use
== if you want the excat value (dont do that with float values)
<= if you want a value that is equal or lower
< if you want a value that is lower

the snippet you posted does say much, what exactly does not work?

does he continue to accelerate?
does he stop moveing at all etc.

There is also an jump and run example for godot 2.2