Random Terminology: Predicate

Computer science terminology can be confusing, complicated and vast. It’s deep rooted in mathematics and theory. But understanding the terminology is just as important as it is annoying. So today’s random terminology will be a common one: predicate.

According to the dictionary, predicate is defined as:

1. to proclaim; declare; affirm; assert

2. Logic: to affirm or assert something of the subject of a proposition

Both are accurate to how we use the term predicate in computer science. Simply put, a predicate is a function that returns a boolean value (true or false). This term comes from the mathematical definition of a predicate that is: a function returning a boolean value (F: X -> {true, false}).

If you’re a software engineer then you’ll hear the term predicate used in reference to a function/method that returns true or false (boolean). A Ruby example of a predicate:

1
2
3
4
5
6
def greaterThanZero?(n)
  n > 0
end
 
# Returns true
greaterThanZero? 1

Bob Hensley

IT Manager | Webmaster | Social Media Strategist | SEO Specialist | Copywriter at Fairfield's Auto Group
Bob Hensley is an IT Manager, Webmaster and all-around advertising guy by day; database theory junkie by night.Born and raised in New England, he lives just a couple hours outside of Boston with his lovely wife and one year old son.He's a technologist, and thoroughly enjoys finding new ways to use technology to better efficiency and work flows.

Latest posts by Bob Hensley (see all)

Leave a Reply

Your email address will not be published. Required fields are marked *

*