Assign only if not already defined in Julia
julia
Solution
You can use the `@isdefined` macro: `(@isdefined x) || (x = NEW_VALUE)`.
Problem
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?