Premium Chapter

Programming paradigms & scope

Computer Science & Applications (Paper 2) (Code 87) · Unit 3 · ~15 min read · Original chapter

Free previewPremium full chapter

Free preview

A programming paradigm is a way of thinking about computation. Imperative programming says how to change state step by step; functional programming says what to compute with expressions and no mutable state; logic programming says what is true and lets the system find the answer; object-oriented programming organises state and behaviour into objects. Worked example — scope: in a language with static (lexical) scoping, the binding of a variable is decided by where the code is written, not where it is called from. So if a function prints a global x, it prints the global value even when called from a function that has its own local x. That single distinction — text versus call site — answers most scope questions.

Checking premium access…