aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaurĂ­cio Antunes <mauricio.abreua@gmail.com>2022-11-20 07:53:41 -0300
committerMaurĂ­cio Antunes <mauricio.abreua@gmail.com>2022-11-20 07:53:41 -0300
commitf8c1f63f66840fc96b9b2eed93b99215a65cc15c (patch)
tree91493b7f2bab2ab1bb2bc2e267ae5f8ba502d586
parentd79a99afed5ba12c6f23bf8666023f28d2877e73 (diff)
feat: add first array exercise
-rw-r--r--exercises/arrays/arrays1/main.go18
-rw-r--r--info.toml7
2 files changed, 25 insertions, 0 deletions
diff --git a/exercises/arrays/arrays1/main.go b/exercises/arrays/arrays1/main.go
new file mode 100644
index 0000000..2782058
--- /dev/null
+++ b/exercises/arrays/arrays1/main.go
@@ -0,0 +1,18 @@
+// arrays1
+// Make me compile!
+
+// I AM NOT DONE
+package main
+
+import "fmt"
+
+func main() {
+ var colors [3]string
+
+ colors[0] = "red"
+ colors[1] = "green"
+ colors[2] = "blue"
+
+ fmt.Printf("First color is %s:\n", colors[])
+ fmt.Printf("Last color is %s:\n", colors[])
+}
diff --git a/info.toml b/info.toml
index fe87134..1ee1b5b 100644
--- a/info.toml
+++ b/info.toml
@@ -125,3 +125,10 @@ path = "exercises/primitive_types/primitive_types4/main.go"
mode = "compile"
hint = """
byte can hold from 0 to 255. Could it store a character?"""
+
+[[exercises]]
+name = "arrays1"
+path = "exercises/arrays/arrays1/main.go"
+mode = "compile"
+hint = """
+Arrays are zero-based indexing."""