Flag Argument

noun

say it: “FLAG AR-gyoo-ment” /flæɡ ˈɑrɡjumənt/

A true or false argument that switches a method between two different jobs.

What is a flag argument?

A flag argument is a true/false argument that changes what a method does: book(member, yogaClass, true) puts the member on the waitlist instead of booking a place. Every reader has to look up what true means. It's a code smell of choosing, and the usual cure is two methods, each named for its job, such as book and addToWaitlist.

In a sentence

  • “The flag argument meant nobody could tell from the call whether Sam was booked or waitlisted.”

Level: Journeyman · More Software Development terms at this level

Updated