Reference > Rule Languages > ILOG Rule Language > IRL Keywords > body (in Function Task)

Summary

The keyword used to define a function task body. This keyword is used in the functiontask definition

Syntax

functiontask functionTaskName 
{
    body 
    {
       action1;
       ...
       actionn;
     }
};

Description

The function task body is equivalent to an IRL function without arguments and whose return type is void. The task execution consists in executing the statements that compose its body (after its initial actions and before its final actions, if they are defined).

Example

functiontask UpdateDistance
{
   body =
   {
      int x = move.x;
      int y = move.y;
      for (var i = y + 1; i < 10; i++)
      {
         int p = grid.position(x,i);
         if (p == null) break;
         p.distance--;
         update(p);
      }
   }
};

See Also

evaluate, for, functiontask, if, modify, retract, return, throw, try, update, while