Question: How can I re-write this expression so it can be evaluated as true or false.

I have the following procedure that I am working with. I would like to store the result of the procedure in a variable called "result".

[code]
f := proc(result, x)
     if x <= -7 then
         result :=  1:
     elif x > -7 and x <= 7 then
         result := 2:
     elif x > 7 then
         result := 3:
     end if:

     return result;
end proc:
[/code]

However, when I try to call the procedure with:

[code]
result;

f(result, 2);
result;
[/code]

It gives me the error:
Error, (in f) cannot determine if this expression is true or false: 2 <= -7

I have tried using 'f'(result, 2); and also using 'f(result,2)'; but neither have worked.

Please Wait...