# General Syntax ## Type Binding Some name may be bound to some type by using the `:` (colon) syntax. ``` name: Type ``` Type bindings are used for all such occurrences. This includes: - [Defining Variables](variables.md) - [Defining Records](records.md) - [Defining Functions](functions.md) ## Value Binding Some name may be bound to some value by using the `:=` syntax. ``` name := value name: Type := value ``` ## Comments Comments are lines where the first non-whitespace characters are `--`. This was selected for ease of typing paired with low visual noise. ``` -- this is a comment -- this is another comment let x := "foo" -- this will not compile, comments cannot be mixed with code ``` Ava does not support multi-line comments. ## Code Documentation Code documentation is written using comments that both directly-precede certain definitions and have 3 `-` characters: ``` --- This function does some foo as well as some bar. --- @param x Documentation for the `x` parameter. fn foo_bar: (x: String) => Int32 ``` ## Block Definitions All block definitions are closed by a companion `end` keyword that refers to the initating keyword. ``` fn foo: () => () () end fn given A class Bar fn foo2: () => () end class instance Bar[A] fn foo2: () => () () end fn end instance enum Color object Red object Green object Blue end enum fn control_if: () => () if 1 + 1 > 2 then () else if 2 + 2 > 4 then () else () end if end fn fn control_do: () => Option[Int32] do x <- Some(1) y <- Some(2) return x + y end fn fn control_match: () => Int32 match "foo" case "foo" => 1 case _ => 0 end match end fn infix plus: (left: Int32, right: Int32) => Int32 left + right end infix ```