Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Instead of repeating the expression every time, we can rewrite this formula using the WITH  WITH construct:

Code Block
WITH total_time = time_spent + remaining_estimate :
  IF total_time > 0 :
     time_spent / total_time

You can define multiple local variables in succession. You can also use previously defined local variables when defining additional local variables. For example:

Code Block
WITH total_time = time_spent + remaining_estimate :
WITH progress = (IF total_time > 0 : time_spent / total_time) :
  IF(progress > 0.5, "Great Progress!", progress > 0.2, "Good Progress", "Needs Progress!")

Tip

Note the position of the colon (":") – it must be present where each local variable definition ends.