Skip to content

Syntax Basics

Devlish is a programming language written as a controlled subset of English. Its phrases have specific meanings: the compiler reads explicit statements rather than interpreting an open-ended natural-language request. This makes a program readable while keeping its execution defined by the code.

This page introduces how to read and write those statements: comments, assignment, names, arithmetic, and conditions. Start here before the topic pages, or follow the Quick Start to see them in a small working program.

One statement per line. Blank lines are allowed. Comments start with #.

# This is a comment
total cost equals base price plus tax
# Blank lines separate logical sections
Print total_cost

Use equals to assign a computed value. Use is to define a term.

# Assignment: calculate and store
total exposure equals liability_cap plus deductible
status equals "pending"
# Definition: declare what a term means
liability cap is the maximum amount payable
termination notice is days required before termination

Multi-word names are written naturally and normalized to snake_case internally. Both forms refer to the same variable.

Ask "What is your name?" as user name
# Stored as user_name internally
Print user_name

Helper snippets below show expressions only. Use them after equals, Print, or Respond with in a program.

Devlish supports both English words and symbols for arithmetic.

base plus surcharge
revenue minus expenses
width times height
total divided by count
# Symbol equivalents
base + surcharge
width * height
total / count

Comparisons are used in conditions and validation statements.

If score > 70:
Print "passed"
If retry_count >= 3:
Fail with "Too many retries"
If status equals "approved":
Print "ready"

Available comparisons: >, <, >=, <=, equals.

Combine conditions with and and or.

If score > 70 and status equals "active":
Print "eligible"
If region equals "US" or region equals "CA":
Print "North America"

Strings use double quotes. Concatenation uses plus.

"Hello, " plus user_name
directory plus "/" plus filename

String helpers are available for transformation:

uppercase user_name
lowercase user_name
trim raw_input
slugify title