A compact map of the forai language: function contracts, tests, types, modules, optionals, and the CLI workflow.
# Compute an area.
def area
@param width Float
@param height Float
@return Float
do
width * height
end
test area
it 'multiplies dimensions'
assert.equals(area(3.0, 4.0), 12.0)
end
endtype Package
name String
version String
end
let pkg = Package(name: 'forai', version: '0.1.0')
let maybeName String? = null
if maybeName?
print(maybeName!)
enduse { HomePage } from pages.home
use { Label, padding } from Forui.viewfai fmt
fai check
fai test
fai run
fai build
fai doc std.stringremote def currentUser
@return User?
do
requireSession()
end