Global Variable

Published by nilnull in

Create a function that returns how often it has been called previously (i.e. return the count value pre-increment).

Examples

counter() ➞ 0

counter() ➞ 1

counter() ➞ 2

counter() ➞ 3

Notes

A global variable is needed for this task.

Watch a quick demo on how Edabit works.