A variable is:
This_IS_a_variable).
_this_IS_a_variable).
_). The underscore
character is referred to as the anonymous variable because it
cannot be referenced by its name in other parts of the clause.
The Prolog built-in predicate var/1 will tell you if a given term is
or isn't a variable. It gives the following behaviour:
| ?- var(Foo).
Foo=_125459
yes
| ?- var(_).
yes
| ?- var(foo).
no