The {Array} part is not necessary. Ref(z) would work just as well.
The reason we use Ref is because when we broadcast functions across elements of an array, like we are doing above, if one of the arguments, say,x, is broadcastable, like an array, as opposed to a scalar, it tries to apply the function to each element of x. If the length of x doesn’t match the length of the other arguments, we throw an error.
This is not the case with scalars. Ref acts as a way to treat a non-scalar argument like a scalar so we can tell Julia not to try and broadcast the function across it.