Struts2的Lambda表达式的使用

如斐波那契数列:函数

C语言实现this

int feibo(int i){spa

   if(i==0){lambda

       return 0;语言

   }else if(i==1){co

   return 1;background

 }return

   else{参数

  return feibo(i-2)+feibo(i-1);

 }

}

针对于Struts2的lambda实现

定义函数

#feibo =: [  函数体 ]

调用:

#feibo(11)

传递一个参数

#this

编写函数体

#this==0?0:#this==1?1:#feibo(#this-2)+feibo(#this-1)

 

所有实现:

<s:property value="#feibo=:[#this==0?0:#this==1?1:#feibo(#this-2)+#feibo(i-1)],#feibo(11)"/>

相关文章
相关标签/搜索