6.2. Comments

Note

(updated to Drools 4.0)

Comments are sections of text that are ignored by the rule engine. They are stripped out when they are encountered, except inside semantic code blocks, like the RHS of a rule.

6.2.1. Single line comment

Single line comment

Figure 6.1. Single line comment


To create single line comments, you can use either '#' or '//'. The parser will ignore anything in the line after the comment symbol. Example:

rule "Testing Comments"
when
    # this is a single line comment
    // this is also a single line comment
    eval( true ) # this is a comment in the same line of a pattern
then
    // this is a comment inside a semantic code block
    # this is another comment in a semantic code block
end

6.2.2. Multi line comment

Multi line comment

Figure 6.2. Multi line comment


Multi-line comments are used to comment blocks of text, both in and outside semantic code blocks. Example:

rule "Test Multi-line Comments"
when
    /* this is a multi-line comment
       in the left hand side of a rule */
    eval( true )
then
    /* and this is a multi-line comment
       in the right hand side of a rule */
end