What is a predicate?

前端 未结 12 1713
无人及你
无人及你 2020-12-04 12:16

Being a hobbyist coder, I\'m lacking some fundamental knowledge. For the last couple days I\'ve been reading some stuff and the word \"predicate\" keeps reappearing. I\'d ve

12条回答
  •  自闭症患者
    2020-12-04 12:31

    The best S.O. answer around predicates, that I have found, is on a duplicate question.

    To summarize, in natural languages a predicate is the part of the sentence that describes a subject.

    Jane is tall

    Jane is the subject and is tall is the predicate.

    In computer science we are not interested in asserting a fact about a subject but rather testing if something is true or false.

    jane.isTall();
    

    Here jane is some object with a predicate method that will return either true or false.

提交回复
热议问题