lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Wed, Jul 9, 2014 at 5:05 PM, Coroutines <> wrote:

> The spaceship operator is my favorite ("<=>"):

Another fun one is the NULL coalescing operator found in some languages.

In Lua you handle default args like:

if default_arg then
    default_arg = 3

-- or

default_arg = default_arg or 3

(let's pretend I'm comparing against nil for best practices)

Anyway, C# has "??" to do that: default_arg = default_arg ?? 3;