Beginner [Exercise 5: Control flow] (Training slides exercise)

Create 2 input fields that allow the user to enter a budget value and an actual one and build an if statement that will display the following text depending on the value entered by the user.

  • If both values are blank: There is no data for the current period.
  • If actuals are greater than budget: The budget was underestimated for the current period.
  • If budget is greater than actuals: The budget was overestimated for the current period.
  • If both values are equal: The budget was accurately estimated for the current period.

Solution:

**Budget** {% input custom.budget.cy as:integer placeholder:0 %}
**Actuals** {% input custom.actuals.cy as:integer placeholder:0 %}

{% if custom.budget.cy == blank and custom.actuals.cy == blank %}
  There is no data for the current period.
{% elsif custom.actuals.cy > custom.budget.cy %}
  The budget was underestimated for the current period.
{% elsif custom.actuals.cy < custom.budget.cy %}
  The budget was overestimated for the current period.
{% else %}
  The budget was accurately estimated for the current period.
{% endif %}