4.14.3 Flags
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • Database
          • Flags
            • get_flag/2
            • set_flag/2
            • flag/3
    • Packages
Availability:built-in
Sourceflag(+Key, -Old, +New)
True when Old is the current value of the flag Key and the flag has been set to New. New can be an arithmetic expression. The update is atomic. This predicate can be used to create a shared global counter as illustrated in the example below.
next_id(Id) :-
    flag(my_id, Id, Id+1).