Consequences grammar

A consequence is a message to display or an action to be performed at the end of the test, under certain conditions.

A consequence can be expressed as : if condition then action

A condition can be a single test or a logical combination of single conditions:

  • if condition1 and condition2 then action
  • if condition1 or condition2 then action
  • if (condition1 and condition2) or condition3 then action


The conditions relate to tests performed on scores in percent % (global score, score per domain or per tag).

  • Test on the global score : global_score
  • Test on a specific domain score ‘economy’ : domain_score_economy
  • Test the specific tag ‘best practices’ : tag_score_best_practices

Comparisons operators are : > , >= , <<=== (equality)

Logical operators are : andor

Messages and Actions

An action can be a specific message on the results page, an invitation to a questionnaire or a module or an assignment to a group : Actions are :

message(“…”), questionnaire(“…”), module(“…”), in_group(“…”), out_group(“…”) Here are variables that can be included with [] inside messages:

A message must be written in the Messages section and an action in the Actions section.

[first_name] [last_name] [global_score] [domain_score_economy] [tag_score_best_practices] …

Note : An action that starts a new line must be preceded by blanks. You may specify a list of actions, under the same condition, with each action on a separate line starting with 4 blanks.


if  global_score >= 60  and  domain_score_economy <= 40  then message("Congratulations [first_name] [last_name]!")

if  global_score >= 60  and  domain_score_economy <= 40  then message("Congratulations: you can obtain a [badge](")

if  global_score >= 60  and  domain_score_economy <= 40  then message("Congratulations: you can visit the site ou ")

if  (domain_score_economy == 0  and  domain_score_statistics >= 80) then out_group("Experts")

if  tag_score_best_practices == 100  then module("Expert MO")

Note : It is possible to define a message or an action without conditions.

Example of permament message:

message("Congratulations [first_name] [last_name]!")

Example of permament action:

email("administrator", "End of test", "end of test for [first_name] [last_name]")

Code verification

You can check your code by assigning some variables with =. Just click on button ‘CHECK CODE’ Each assignment must be on one line ::

global_score = 75
domain_score_economy = 30
tag_score_best_practices = 100

Click on ‘CODE VALIDATION’ button, messages are displayed as well as questionnaires or modules invitations:

Message : Advice to John! Check the economy chapter, your score is 30%.