The cut, in Prolog, is a goal, written as !, which always succeeds but cannot be backtracked.
While cuts can be inserted into code containing errors, if a test is unnecessary because a cut has guaranteed that it is true, it is good practice to say so in a comment at the appropriate place.
[1] Some programmers call the cut a controversial control facility[2] because it was added for efficiency reasons only and is not a logical formula.
tells the interpreter to stop looking for alternatives; however, if gotmoney(X) fails it will check the second rule.
Although checking for gotmoney(X) in the second rule may appear redundant since Prolog's appearance is dependent on gotmoney(X) failing before, otherwise the second rule would not be evaluated in the first place.