Soulver 3 for Mac, iPad & iPhone
  • Frequently asked questions
  • Changelog
  • Request a new feature
  • What's new in Soulver 3?
  • Features
    • Getting Started
    • Totals & Subtotals
    • Line References
    • Variables
    • Formatting
      • Number Formats
      • Text Stying
      • Answer Formatting
    • Sheets & Files
      • Sheets
      • Sheetbooks
      • Soulver Files (.slvr)
    • Live Data
      • Weather
      • Stock Prices
      • Wolfram|Alpha (knowledge assistant)
    • Exporting
      • PDF & Printing
      • Soulver Studio
    • Integrations
      • Alfred & Raycast
      • macOS Services
      • URL Schemes
      • Terminal (CLI)
    • Tips & Tricks
      • Mac
      • iPad & iPhone
  • Syntax Reference
    • General
      • Operators
      • Rounding
      • Averages & Median
      • Logarithms & Roots
      • Trigonometry & Constants
      • Conditionals
      • Miscellaneous
    • Percentages
    • Units & Conversions
      • Converting Units
      • Currencies
      • Rates
      • Cooking Calculations
      • Unit Reference
      • Currency Reference
    • Dates
      • Calendar Calculations
      • Workdays & Weekdays
      • Timestamps & ISO8601
    • Time
      • Time Zone Conversions
      • Time Formats
      • Clock Time Calculations
      • Video Timecode & Frame Rates
    • Money & Finance
      • Compound Interest & Investments
      • Mortgage/Loan Repayments
  • Bases & Bitwise
  • Headings & Comments
  • Large Number Symbols
  • 🧪Experimental
    • Soulver X Series on GitHub
Powered by GitBook
On this page

Was this helpful?

  1. Syntax Reference
  2. General

Conditionals

Like many programming languages, Soulver supports conditionals, (sometimes called "if statements").

In Soulver, a conditional is expressed on a single line:

earnings = $45k                                     | $45,000.00

if earnings > $30k then tax = 20% else tax = 5%     | 20%

My tax paid: earnings × tax                         | $9,000.00

Declare a variable using a conditional

income = $35k
expenses = $21.5k

profitable = true if income > expenses        | true
insolvent = false unless expenses > income    | false

Using "and" and "or" in conditionals

BMI = 24
Underweight = BMI < 18.5                        | false
Healthy Weight = BMI >= 18.5 and BMI < 25       | true
Overweight = BMI >= 25 and BMI < 30             | false
Obese = BMI >= 30                               | false

&& and || are also supported

Comparison operators & booleans

A boolean value (true or false) is returned).

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

Last updated 1 month ago

Was this helpful?

Soulver supports standard comparison operators.

"C" style