Docs/Language

Language

Variables and types

Use mutable and immutable bindings, primitive types and optional annotations.

About 9 minVersion: 0.10.1

let and const

let creates a mutable binding. const creates an immutable binding that cannot be assigned again. Add an annotation when the contract matters, or omit it for a dynamic binding.

types.orvi
1let retries: int = 32let ratio: float = 0.753let label: string = "release"4let enabled: bool = true5let flexible = "inferred at runtime"67const project_name: string = "OrviScript"

Built-in types

  • int and float represent numeric values. number accepts either numeric form.
  • string and bool represent text and boolean values.
  • void means no value was returned. null is a distinct value and type.
  • list<T>, map<T>, Option<T>, Result<T, E>, Future<T>, Task<T> and Worker<T> are generic types.
  • any is the explicit dynamic type.

Types are enforced

Annotated bindings are checked during initialization and assignment. Function arguments and return values are checked at their boundaries. OrviScript does not silently turn a string into a number.