From 931eb0894e7cd3717f1218f0eb06382b11734c13 Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Sun, 3 Aug 2025 22:29:47 +0200 Subject: vault backup: 2025-08-03 22:29:47 --- Array notation.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Array notation.md (limited to 'Array notation.md') diff --git a/Array notation.md b/Array notation.md new file mode 100644 index 0000000..b4cc810 --- /dev/null +++ b/Array notation.md @@ -0,0 +1,13 @@ +[[Rust]] + +The array notation is a bit special compared to other languages so I will write it down here: + +Unlike tuples, arrays can only hold one type: + +`let a: [i32; 5] = [1, 2, 3, 4, 5]` Specifies an array of length 5. +`let a = [3; 5];` specifies an array of length 5 with all values set to 3. +> Note the semicolon rather than a comma! + +Indexing as usual + +Out of bounds access result in a panic. \ No newline at end of file -- cgit v1.2.3