This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Constantin Jacob
Posted Jul 14 - Read on Facebook

Is there a way to check against null/nil (does not exist)? If I read stuff on stackoverflow right I have to use 'when x?' ??


Balraj Chana

How about this:

foo = null
if !foo? then...

bar = ""
if bar? then...

Stefan Hvlmnns

if 'null' != typeof foo

Fran Pérez

if not foo?

Jordan Robert Dobson

Basically that's what foo? Does. It will return true if it contains a valid value false if it's empty value.

Jordan Robert Dobson

So if you want to assign a value if it's empty and set it to "hello" or ignore if it's already set then...

foo ?= "hello"

Read the entire post on Facebook