diff options
-rw-r--r-- | exercises/slices/slices2/main.go | 13 | ||||
-rw-r--r-- | info.toml | 7 |
2 files changed, 20 insertions, 0 deletions
diff --git a/exercises/slices/slices2/main.go b/exercises/slices/slices2/main.go new file mode 100644 index 0000000..54595ff --- /dev/null +++ b/exercises/slices/slices2/main.go @@ -0,0 +1,13 @@ +// slices2 +// Make me compile! + +// I AM NOT DONE +package main + +import "fmt" + +func main() { + names := [4]string{"John", "Maria", "Carl", "Peter"} + lastTwoNames := names[] // after figuring out the answer, try with other low/high bounds + fmt.Println(lastTwoNames) +} @@ -148,3 +148,10 @@ path = "exercises/slices/slices1/main.go" mode = "compile" hint = """ Slices can be created with the make function and they must have a type.""" + +[[exercises]] +name = "slices2" +path = "exercises/slices/slices2/main.go" +mode = "compile" +hint = """ +Slices can be created from arrays and you can slice it with a range, with the [low:high] syntax.""" |