aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaurĂ­cio Antunes <mauricio.abreua@gmail.com>2022-11-21 08:23:04 -0300
committerMaurĂ­cio Antunes <mauricio.abreua@gmail.com>2022-11-21 08:23:04 -0300
commit7f67d60b889c80cff69028ee44b9717129ecf938 (patch)
tree3ef454cb6933ccac8fa000fae51588c26321af5a
parent9a9c0a00e6b6635514bbd0ac78ed6c2b55aa4ef8 (diff)
feat: add first slice exercise
-rw-r--r--exercises/slices/slices1/main.go13
-rw-r--r--info.toml7
2 files changed, 20 insertions, 0 deletions
diff --git a/exercises/slices/slices1/main.go b/exercises/slices/slices1/main.go
new file mode 100644
index 0000000..291f33d
--- /dev/null
+++ b/exercises/slices/slices1/main.go
@@ -0,0 +1,13 @@
+// slices1
+// Make me compile!
+
+// I AM NOT DONE
+package main
+
+import "fmt"
+
+func main() {
+ a := make(, 3, 10) // play with length and capacity
+ fmt.Println("length of 'a':", len(a))
+ fmt.Println("capacity of 'a':", cap(a))
+}
diff --git a/info.toml b/info.toml
index e73b208..3ce9023 100644
--- a/info.toml
+++ b/info.toml
@@ -141,3 +141,10 @@ path = "exercises/arrays/arrays1/main.go"
mode = "compile"
hint = """
Arrays are zero-based indexing."""
+
+[[exercises]]
+name = "slices1"
+path = "exercises/slices/slices1/main.go"
+mode = "compile"
+hint = """
+Slices can be created with the make function and they must have a type."""