# Requirements for formulae

Formulas should always include an explicit **return** statement. Simple formulae will still resolve, but more complex formulae will be unable to present an answer without one.

An example of this can be found in a conditional formula:

= if($'Number of Units' > 5) {

return 'true';

}

else {

return 'false';

}

# Return types

We support a number of different return types:

**Numbers**(floats and integers are both supported)`= 1`

**Strings**`= 'Hello world!'`

**Dates**`= new Date (2014,1,28)`

**Boolean**`= true`

**Array**(only arrays of primitive types are allowed, and all elements of the array must be of the same primitive type)`= [1,1,2,3,5,8]`

**Object**(the values of the object can only be primitive types, and all values of the object must be of the same primitive type)`= {'first': 10, 'second': 20}`

**Basic Math**`= 1+1`

`= 5*25`

`= Math.pow(10, 10)`

# Unsupported functions

Streak's formula functionality is built on Rhino, which is lightly limited in its functionality. You'll find that most common ES5 functions will work, but there is a limit there, too: **we do not support XHR or any HTTP requests from formula.**

Because of the way formulas are computed, we also advise against using a function like **Date.now()**, which will not update daily.