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
loopInfinite loop
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
asType casting
inUsed in for loops
revertAbort execution and revert state
assertCheck a condition, revert if false

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 { }
loop { break }
return value
fn foo() uses (storage: Storage) { }
fn foo() uses (mut storage: 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
  • ref
  • static
  • super
  • unsafe
  • use
  • mod
  • crate

Fe has approximately 40 keywords covering:

  • 13 declaration keywords
  • 9 control flow keywords
  • 4 type keywords
  • 2 effect keywords
  • 2 contract keywords
  • 4 other keywords
  • 2 contextual keywords