Briefle
LearnGlossaryPricing

Briefle words · Code & architecture

Pure function

A function whose result depends only on its inputs and that changes nothing outside itself.

Say it to an AI

Python pure function order_total(items, delivery_fee, promo=None) that returns the total in integer cents with a 5% service fee rounded to a whole cent. No side effects: don't mutate items or the order, no globals; handle the FREEDEL promo inside and keep it deterministic so it's trivially unit-testable.

How an expert would brief the stronger version of “Order total”.

See it

Try it as a puzzle →

A food-delivery backend prices a customer's basket before showing the checkout screen.

Study A · the weaker one
Study B · the stronger one

Why: B takes 'items', 'delivery_fee' and 'promo' and just returns a total in whole cents; nothing else in the program is touched.

Related words

  • Single responsibility principle
  • Flag argument
  • Side effect
  • Parameter object
  • Long parameter list
  • Named arguments
  • Options object
  • Utils file

Room 3 · Functions & structure

Learn “Pure function” in a five-minute lesson

Start free
AI can build almost anything. The bottleneck is saying what you want.
WordsPricingTermsPrivacyRefundsContact
© 2026 Briefle