Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

OGNL supports basic lamba expression syntax enabling you to write simple functions. For example:

For all you math majors who didn't think you would ever see this one again.
Fibonacci: if n==0 return 0; elseif n==1 return 1; else return fib(n-2)+fib(n-1);
fib(0) = 0
fib(1) = 1
fib(11) = 89

Info
titleUseful Information

The lambda expression is everything inside the brackets. The #this variable holds the argument to the expression, which is initially starts at 11.

Code Block
xml
xml
<ww:property value="#fib =:[#this==0 ? 0 : #this==1 ? 1 : #fib(#this-2)+#fib(#this-1)], #fib(11)" />