From 7f67d60b889c80cff69028ee44b9717129ecf938 Mon Sep 17 00:00:00 2001 From: MaurĂ­cio Antunes Date: Mon, 21 Nov 2022 08:23:04 -0300 Subject: feat: add first slice exercise --- exercises/slices/slices1/main.go | 13 +++++++++++++ info.toml | 7 +++++++ 2 files changed, 20 insertions(+) create mode 100644 exercises/slices/slices1/main.go 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.""" -- cgit v1.2.3-70-g09d2