Skip to content

How to return an empty message #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fernandogmar opened this issue Dec 19, 2017 · 3 comments
Closed

How to return an empty message #77

fernandogmar opened this issue Dec 19, 2017 · 3 comments

Comments

@fernandogmar
Copy link

Hello!

I am just trying to do this:

test = {  $num ->
    *[0]         
     [other]         No empty text
}

but it gets an error:

TypeError
Cannot read property 'undefined' of undefined

How can an empty string be returned?

@stasm
Copy link
Contributor

stasm commented Dec 19, 2017

You ran into two paper-cuts here, both of which we're currently working on :) Hopefully the next release of the syntax spec (0.5) will solve both of them!

First, it's currently required to indent all of the message's body, including the closing brace } on the last line of your example. This will be fixed by #42.

#63 has a recommendation on how to explicitly define empty-string values: {""}. It a placeable with an empty string inside. Consider the following snippet:

test =
    { $num ->
         [0] {""}
        *[other] No empty text
    }

You can see it live in the Playground (use the Config tab to change the value of $num).

@fernandogmar
Copy link
Author

Thanks {""} worked like a charm ;)

@stasm
Copy link
Contributor

stasm commented Dec 19, 2017

Glad to hear! I'm going to close this issue now. Feel free to open a new one if you have any other questions.

@stasm stasm closed this as completed Dec 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants