Assign only if not already defined in Julia

Viewed 4135

Is there simple Julia syntax for assigning to a variable only if it is undefined (or falsy)? I mean something like Ruby's x ||= NEW_VALUE. I have tried x || x=NEW_VALUE but it throws an error. Barring easy syntax, what function can I use to check if a variable is defined?

2 Answers
Related