Search code examples
grammarkrl

Why is the keyword 'then' required in KRL


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?


Solution

  • Probably because the writers of the language felt that adding then was more natural.