Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ You can also initialize with literal values using the `array![]` macro:
let arr = array![1, 2, 3, 4]; // Implicitly Array<felt252>
----

For fixed-size array literals such as `[1, 2, 3]` and repeat syntax such as `[0; 4]`, see
xref:array-expressions.adoc[Array expressions].

== Common Operations

- **Append** — adds an element to the end:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
= Enums

An enum is a type that can hold one of the types from the list of its defined variants.
An enum is a user-defined type that can hold one of the types from the list of its
defined variants.
Each variant has its own type, and when such an enum variable holds a variant,
it contains a value of the type of the variant.
It is one of the ways to define custom user types.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ Concrete paths are used in:
foo::bar::<bool>() // Function call expression
Option::<bool>::Some(true) // Enum variant expression
----
+
For standalone uses of concrete paths as expressions, see
xref:path-expressions.adoc[Path expressions].

* Type expressions
- `let x: Option<bool> = None;` // Let statement type clause
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ struct ListNode {

== Usage

A struct is instantiated with the `StructName { member1: value1, member2: value2, ... }` syntax.
A struct is instantiated with the xref:struct-expressions.adoc[struct expression] syntax
`StructName { member1: value1, member2: value2, ... }`.
For example:

[source,cairo]
Expand Down Expand Up @@ -86,6 +87,7 @@ in the deconstruction. See xref:patterns.adoc[patterns] for more information.
=== The Dot (`.`) operator:

Another way to access struct members is with the dot (`.`) operator.
See xref:member-access-expressions.adoc[Member access expressions] for more details.

[source,cairo]
----
Expand Down
Loading