为什么关键字是“then”? KRL 中需要
当我在 KRL 规则中编写条件操作块时,我总是忘记“then”关键字。这是正确的语法:
rule with_conditions {
select when pageview ".*"
pre {
cheese = "Camembert";
}
if (cheese like re/bert/) then {
notify("Odd Cheese", "#{cheese} is unusual.");
}
fired {
raise explicit event "odd_cheese";
}
}
为什么是“then”?没有它不是一样清楚吗?
When I'm writing a conditional action block in a KRL rule I always forget the 'then' keyword. Here is the correct syntax:
rule with_conditions {
select when pageview ".*"
pre {
cheese = "Camembert";
}
if (cheese like re/bert/) then {
notify("Odd Cheese", "#{cheese} is unusual.");
}
fired {
raise explicit event "odd_cheese";
}
}
Why 'then'? Wouldn't it be just as clear without it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能是因为该语言的作者认为添加
then
更自然。Probably because the writers of the language felt that adding
then
was more natural.