Keywords
This page lists all keywords in Felico and their usage.
Control Flow
if
Conditional expression.
if condition {
// code
}
else
Alternative branch for if.
if condition {
// code
} else {
// alternative
}
while
Loop while condition is true.
while condition {
// code
}
break
Exit from a loop early.
while true {
if done {
break
}
}
continue
Skip to next loop iteration.
while i < 10 {
i = i + 1
if i % 2 == 0 {
continue
}
print(i)
}
return
Return from a function.
fn max(x, y) {
if x > y {
return x
}
return y
}
Declarations
let
Variable declaration.
let x = 42
let name: string = "Felico"
fn
Function declaration.
fn greet(name) {
print("Hello, " + name)
}
Literals
true
Boolean true value.
let flag = true
false
Boolean false value.
let flag = false
Reserved for Future Use
The following keywords are reserved for potential future features:
match- Pattern matchingfor- For loopsin- Iterator syntaxstruct- Custom data typesenum- Algebraic data typestrait- Type classes/interfacesimpl- Trait implementationstype- Type aliasesconst- Compile-time constantsmut- Mutable bindingspub- Public visibilitymod- Module declarationsuse- Import statementsas- Type casting/aliasingasync- (Maybe not, due to function coloring concerns)await- (Maybe not, due to function coloring concerns)
Contextual Keywords
Some identifiers have special meaning only in certain contexts. These are not strictly reserved and may be used as variable names:
self- Receiver in method syntax (planned)super- Parent module reference (planned)