Thursday, June 4, 2015

Prolog Variables

Variables always start with an upper case alphabetic character or an underscore.

Other than the first character they can be made up of any mixture of letters, digits, and underscores.
 
  e.g.   X, ABC, _89two5, _very_long_variable


There are no “types” for variables (or constants) – a variable can take any value.

All Prolog variables have a “local” scope:
they only keep the same value within a clause; the same variable used outside of a clause does not inherit the value (this would be a “global” scope). 

No comments:

Post a Comment