0
votes

I'm getting the issue: Syntax error: Operator expected

This is my code

reduceBy1(Input,Output) :-
    (Input > 0 -> Output = Input - 1).  

What am I doing wrong? The error points towards the "."

1
Try this, did not check. Change Output = Input - 1 to Output is Input - 1. HTH - Guy Coder

1 Answers

0
votes

You should use is instead of =.

reduceBy1(Input,Output) :-
    (Input > 0 -> Output is Input - 1). 

?-reduceBy1(5,O).
O = 4