Caffeinated Coder
Book an appointment
Lesson 05 · Basics

Methods

A method is a named block of code you write once and call by name as often as you need. Read the signature int Add(int a, int b), then follow two calls step by step: the arguments are copied into the parameters of a new frame on the call stack, the body runs, and return sends one value back to the caller before the frame goes away. The program prints 15.

10 min9 steps5 questionsBeginner
Fig 5 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.