Conditionals & Comparisons

if x then y else z

If/else statements

Like programming languages, Soulver supports conditionals. The main difference is that in Soulver a conditional is expressed over a single line

earnings = $45k | $45,000.00
if earnings > $30k then tax = 20% else tax = 5%
My tax paid: earnings × tax | $9,000.00

You may omit the else statement

Comparison operators & booleans

Soulver supports standard "C" style comparison operators. Booleans are either true or false.

Name

Operator

Equal to

==

Not equal to

!=

Greater than

>

Less than

<

Greater than or equal to

>=

Less than or equal to

<=

You may assign a variable a boolean value directly

cost = $500
discount = true
if discount then cost = cost - 10%
cost | $450.00

You can also use comparison operators outside if statements

20km == 20,000 m | true
11:30 am < 9:30 am | false