In some cases you can also do:
x = x or []
Your method is best when you might get falsy values but if that’s not an issue the `or` method is handy.