When I try to feed the following function an array, it gives me the following error: % Expression must be a scalar or 1 element array in this context: . How to modify such that I can either give it a scalar or array?
; return integer -1, 0, or 1, depending on whether x is less than 0, equal to 0, or greater than 0, respectively
function whatisit, x
case 1 of
(x lt 0): y=-1
(x eq 0): y=0
(x gt 0): y=1
endcase
return, y
end