X2
, Max
,
This_node
, ThisNode
.Prolog variables are similar to ``unknowns'' in algebra: Prolog tries to find values for the variables such that the entire clause can succeed. Once a value has been chosen for a variable, it cannot be altered by subsequent code; however, if the remainder of the clause cannot be satisfied, Prolog may backtrack and try another value for that variable.
The anonymous variable consists of a single underscore. Each occurrence of the anonymous variable is considered to be a new, distinct variable (i.e. different occurrences may have different values).
The scope of a variable name is the clause in which it occurs. There are no ``global'' variables.
|
|