Difference between ?? , has_content , if_exists in freemarker


?? tells if the left hand operand’s value is missing (means it’s null or undefined variable), and gives back false otherwise true (not missing) accordingly.

?has_content is very much like ??, except it also returns false for a 0-length string or empty array, etc.
but It doesn’t return false for a 0, boolean false, etc.

! is used to give a default value when a value is missing. If you omit the right hand operand of !, then the default value is an empty string and empty sequence and empty hash on the same time.

Leave a comment

Your email address will not be published. Required fields are marked *