Values and repeatable tasks
A variable gives a piece of information a name so a program can use it later. An online shop might store a customer’s delivery postcode in a variable and update it if their address changes.
A function groups instructions for a task under a name. One that calculates a total might take a price and tax rate as inputs, then return the result. The program can use it again with different inputs. A function belonging to an object is often called a method.
Why the names matter
Clear variable and function names make code easier to understand and change. Developers can reuse a function instead of writing the same instructions each time.