Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "log"
- )
- func main() {
- slice := []int{1, 2, 3, 4, 5}
- if !(len(slice) == 5) {
- log.Fatal("Wrong length")
- }
- if !(slice[2] == 3) {
- log.Fatal("Wrong value")
- }
- // Remove the 3rd element.
- slice = append(slice[0:2], slice[3:5]...)
- if !(len(slice) == 4) {
- log.Fatal("Wrong length")
- }
- if !(slice[2] == 4) {
- log.Fatal("Wrong value")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement