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 Statement
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
- Learn about Types
- Explore Functions
- Understand Control Flow