[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
PrologAnd
The code below shows two equivalent pieces of code that determine whether a char is a letter.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
PrologAnd
(Prolog) and, , (comma)
Prolog keyword to indicate that more conditions must be true. You can write both and and , (comma).The code below shows two equivalent pieces of code that determine whether a char is a letter.
PREDICATES
nondeterm isLetter(char)
CLAUSES
isLetter(AnyChar) if 'a' <= AnyChar and AnyChar <= 'z'.
isLetter(AnyChar) if 'A' <= AnyChar and AnyChar <= 'Z'.
GOAL
isLetter('&').
PREDICATES
nondeterm isLetter(char)
CLAUSES
isLetter(AnyChar) if 'a' :- AnyChar , AnyChar <= 'z'.
isLetter(AnyChar) if 'A' :- AnyChar , AnyChar <= 'Z'.
GOAL
isLetter('&').
'and' links
Code links
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
