The built-in Prolog extra-logical predicate once takes a single argument, which must be a "callable term" - one that makes sense as a goal - e.g. happy(X) makes sense as a goal, but 23 does not - and calls the term in such a way as to produces just one solution. It is defined as:

once(P) :- P, !.

See also !, call, backtracking.