--- id: math-sign name: Math.sign category: math kind: namespace-method tokens: Math.sign sig: Math.sign(x) -> int tip: The sign of a value as -1, 0, or 1. order: 4 ns: Math member: sign --- Returns -1 when x is negative, 1 when it is positive, and 0 when it is exactly zero. It works on both int and fixed values, since zero and sign are the same in Q16.16. Multiply a step by Math.sign(dx) to move one unit toward a target, or read the sign of a velocity to decide which way a sprite faces. Parameters: - `x` — the value to test ```ludic program FaceTarget { var x: int = 8 var target: int = 20 handler StepToward phase Update { x = x + Math.sign(target - x) # +1 while target is to the right } } ```