Type System Reference¶
Complete reference for USL's type system.
Primitive Types¶
String // Text
Int // 64-bit integer
Float // 64-bit floating point
Boolean // true or false
Timestamp // Point in time
Date // Calendar date
Time // Time of day
Custom Types¶
Collections¶
Option Type¶
Option[T] // Some(value) or None
match optionalValue {
Some(v) => useValue(v)
None => defaultValue()
}
Result Type¶
Result[T, E] // Ok(value) or Err(error)
match result {
Ok(v) => process(v)
Err(e) => handleError(e)
}
Enums¶
Variants (Sum Types)¶
variant PaymentMethod {
CreditCard { number: String, cvv: String }
PayPal { email: Email }
BankTransfer { iban: String }
}
Type Inference¶
USL infers types in many contexts: