Free practice · ordering · medium

Practice

Order a function-call trace

Arrange the execution of a function call that returns a result.

Function contract trace

A caller supplies values and receives one defined result

  1. ContractDefine inputs, output, and failures
  2. ArgumentsEvaluate supplied values
  3. ParametersBind local names
  4. BodyRun focused local logic
  5. ReturnSend the result to the caller
  6. TestCheck the public contract

Keep argument evaluation, parameter binding, local state, return behavior, and external side effects visible at the function boundary.

Arrange in the correct order
  1. 1. Use the returned value in the caller
  2. 2. Evaluate and send the return value
  3. 3. Execute the function body with local state
  4. 4. Bind argument values to parameters
  5. 5. Evaluate the argument expressions