Boomla language docs
Assign statement
+
Overview
Types
Nil type
Boolean type
Numeric types
String type
Array type
Map type
Struct type
Function type
File type
Bucket type
Reference types
Box type
Expressions
Operators
Get expressions
Index expressions
Slice expressions
Grouping
Literals
Instantiations
Identifiers
Call expressions
Xml expressions
Function literals
As expressions
Statements
Import statement
Type declarations
Var declarations
Function declarations
Method declarations
Assign statement
If statement
For statement
Assert statement
Return statement
Fail statement
Panic statement
Yield statement
Break statement
Continue statement
Defer statement
IncDec statement
Expression statement
Block statement
Assign statement
Assign statements change the values stored in variables.
Single assignment.
fn main() { name := "Max" name = "Sarah" println(name) }
Run
Assigning to struct field.
type Person struct { Name string } fn main() { person := Person{ Name: "Max", } person.Name = "Sarah" println(person) }
Run
Assigning to array index.
type Person struct { Name string } fn main() { numbers := []int{ 0, 0, 0 } numbers[1] = 999 println(numbers) }
Run
Assigning to map key.
type Person struct { Name string } fn main() { var inventory map[string]int inventory["apple"] = 7 println(inventory) }
Run
Multiple assignment.
fn main() { var a, b string a, b = "Max", "Sarah" println(a) println(b) }
Run
Multiple function return values are destructured.
fn names() (first string, second string) { return "Max", "Sarah" } fn main() { var a, b string a, b = names() println(a) println(b) }
Run