Skip to content
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

Small improvements in the Rythm template sample in README.md #1

Open
greenlaw110 opened this issue Jun 17, 2013 · 2 comments
Open

Small improvements in the Rythm template sample in README.md #1

greenlaw110 opened this issue Jun 17, 2013 · 2 comments
Assignees

Comments

@greenlaw110
Copy link

The following template segment:

@if (person.getName() != null) {
   Hello @person.getName()!
}

could be written as:

@if (person.getName()) {
   Hello @person.getName()!
}

So @if in Rythm is smart enough to deal with null value. see http://rythmengine.org/doc/directive.md#if for more information.

or it can be even simplifed as

Hello @(person.getName() ?: "new user")

It means if person.getName() is null, then "new user" is output, otherwise the name of the person is output in place

@greenlaw110
Copy link
Author

Another place could be simplified:

@args String who
@args String what
@args String why

version 1:

@args String who, String what, String why

version 2:

@args() {
String who
String what
String why
}

@bcowdery
Copy link
Owner

Thanks for the input! I'll update the example as you've suggested. It certainly helps with the brevity of the app (which was one of the goals).

Sorry for the late reply, the github notification got lost in my in box and I haven't had time to come back to this project. I'm hoping to get back into it soon and start fleshing things out!

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