Suppose you’re writing a function to double a given number. You might naively assume that this would be a reasonable solution:
Instead, use referential semantics as follows to allow the
doubleIt function to have access to the
If you run this you’ll find this function works as you would hope and does indeed double the number passed to it.