79280335

Date: 2024-12-14 08:52:01
Score: 2
Natty:
Report link

If you don't need to short-circuit, you can multiply 0 or 1 times each alternative using boolean operators (or sign). (x>0)*1+(~x)0+(x<0)-1

Octave has the ifelse / merge command, which is exactly what you want. merge(x>0,1,merge(x<0,-1,0))

Reasons:
  • Low length (0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Christopher Crawford