mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-01 23:49:22 -06:00
24 lines
834 B
Plaintext
24 lines
834 B
Plaintext
// Snowball compiler (MIT) /l、
|
||
// https://github.com/snowball-lang/snowball (゚、 。7
|
||
// ⠀ l、゙~ヽ
|
||
// Vectors example for the lang じし(_,)ノ
|
||
// Docs: https://snowball-lang.gitbook.io/docs/
|
||
|
||
// This example shows how to use vectors in Snowball.
|
||
// Vectors are dynamic arrays that can be resized at runtime.
|
||
// They are generic, so you can store any type of data in them.
|
||
|
||
import std::io;
|
||
|
||
public func main() i32 {
|
||
let mut vec = new Vector<i32>();
|
||
|
||
// To add an element to the vector, use the `push` method.
|
||
vec.push(42);
|
||
|
||
// To get the size of the vector, use the `size` method.
|
||
// To get an element from the vector, use the `[]` operator.
|
||
io::println(vec[0]);
|
||
io::println(vec.size());
|
||
}
|