Skip to content
Pre-Release: Fe is under active development. This documentation covers the upcoming release. Follow progress on GitHub

Keyword Reference

This appendix lists all reserved keywords in Fe, organized by category.

KeywordDescription
constDeclares a compile-time constant
letDeclares a local variable
mutMarks a variable or parameter as mutable
fnDeclares a function
structDeclares a struct type
enumDeclares an enum type
traitDeclares a trait
implImplements methods or traits for a type
typeDeclares a type alias
contractDeclares a smart contract
msgDeclares a message type group
pubMakes an item publicly visible
externDeclares external items
KeywordDescription
ifConditional branch
elseAlternative branch
matchPattern matching expression
forLoop over an iterator
whileLoop while condition is true
breakExit a loop early
continueSkip to next loop iteration
returnReturn from a function
KeywordDescription
SelfThe implementing type in trait/impl
selfThe receiver in methods
trueBoolean true literal
falseBoolean false literal
KeywordDescription
usesDeclares effect requirements
withBinds values to effects
KeywordDescription
initContract constructor block
recvMessage receive block
KeywordDescription
ownTakes ownership of a value
refReserved for future use (references)
KeywordDescription
useImport items from other modules
modDeclares a module
ingotRefers to the current ingot root
KeywordDescription
asType casting
inUsed in for loops

These identifiers have special meaning in certain contexts:

KeywordContextDescription
whereGeneric boundsIntroduces where clauses
_PatternsWildcard pattern, ignores value
const MAX_SUPPLY: u256 = 1000000
let balance = 0
let mut counter = 0
fn transfer() { }
struct Token { }
enum Status { }
trait Hashable { }
impl Hashable for Token { }
pub contract MyContract { }
msg TokenMsg { }
if condition { } else { }
match value { }
for item in items { }
while condition { }
return value
fn foo() uses (storage: Storage) { }
fn foo() uses (storage: mut Storage) { }
with (storage: Storage = store) { }
contract Token {
init() { }
recv Msg {
}
}

The following keywords are reserved and may not be used as identifiers:

  • async
  • await
  • dyn
  • move
  • static
  • super
  • unsafe
  • crate

Fe has approximately 40 keywords covering:

  • 13 declaration keywords
  • 8 control flow keywords
  • 4 type keywords
  • 2 effect keywords
  • 2 contract keywords
  • 2 ownership/reference keywords
  • 3 module keywords
  • 2 other keywords
  • 2 contextual keywords