diff --git a/docs/New Operators.md b/docs/New Operators.md index 5b905e7a..dc1aab68 100644 --- a/docs/New Operators.md +++ b/docs/New Operators.md @@ -107,21 +107,12 @@ This operator does not implement any metamethods. The Walrus operator allows you to perform assignments inside of conditional expresssions. ```pluto norun -if a := get_value() then - -- 'a' was assigned a truthy value. -else - -- 'a' was assigned a falsy value. -end -``` -You can imagine it like this, but note they're not always the same: -```pluto norun -do - local a = get_value() - if a then - -- 'a' was assigned a truthy value. - else - -- 'a' was assigned a falsy value. - end +local get_value = || -> 1 + +if val := get_value() then -- scope of 'val' begins + print("got value: "..val) +else -- scope of 'val' ends + print("got no value") end ```