Basic Knowledge: Variables

Variables are specialised → terms to store information during runtime. They can be used to define → literals with a placeholder and (in contrast to → atoms or literals) begin with an upper-case letter.


There are two kinds of variables

  • regular variables, which start with an upper-case letter and
  • the garbage bin variable _, which can be used as a substitute in cases where the content of the variable is not of interest, but a variable has to be provided.


Based on the → time example we added some variables to extract the hour and minute part of the literal

time( current( hour( Hour ), minute( Minute ), period( Period ) ) )
Note: The upper-case variables Hour, Minute and Period can be assigned to values automatically. This mechanism is called → unification.