Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Syntax Basics

This chapter introduces the fundamental syntax of Felico.

Comments

// Single-line comment

/* Multi-line
   comment */

Variables

Variables are declared with the let keyword:

let x = 42
let name = "Felico"
let is_ready = true

Literals

Numbers

let integer = 42
let negative = -10
let float = 3.14

Strings

let greeting = "Hello, World!"
let empty = ""

Booleans

let yes = true
let no = false

Expressions

Most things in Felico are expressions that return values:

let x = 5
let y = x + 10  // 15
let z = if x > 0 { 1 } else { -1 }

Statements

print("Hello")
print(42)
print(true)

Block Statements

Group multiple statements with curly braces:

{
    let x = 5
    let y = 10
    print(x + y)
}

Semicolons

Felico is designed to minimize required punctuation. Semicolons are optional in most cases and used primarily for style or to separate statements on the same line.

Next Steps