Added a caveat default values.
I want to ensure the reader notes the difference between variables and sections.
This commit is contained in:
@@ -170,9 +170,9 @@ one.
|
|||||||
Default Values
|
Default Values
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
By default, an exception will be thrown any time a variable cannot be resolved, or resolves to
|
By default, an exception will be thrown any time a variable cannot be resolved, or resolves to null
|
||||||
null. You can change this behavior in two ways. If you want to provide a value for use in all such
|
(except for sections, see below). You can change this behavior in two ways. If you want to provide a
|
||||||
circumstances, use `defaultValue()`:
|
value for use in all such circumstances, use `defaultValue()`:
|
||||||
|
|
||||||
String tmpl = "{{exists}} {{nullValued}} {{doesNotExist}}?";
|
String tmpl = "{{exists}} {{nullValued}} {{doesNotExist}}?";
|
||||||
Mustache.compiler().defaultValue("what").compile(tmpl).execute(new Object() {
|
Mustache.compiler().defaultValue("what").compile(tmpl).execute(new Object() {
|
||||||
|
|||||||
Reference in New Issue
Block a user