forked from root/public
Compare commits
6 Commits
master
...
1275-popin
Author | SHA1 | Date |
---|---|---|
estlop | 916eefc0c9 | 2 years ago |
estlop | b104757469 | 2 years ago |
estlop | 062e2fd0ce | 2 years ago |
estlop | a7520c4a72 | 2 years ago |
estlop | 381472716b | 2 years ago |
estlop | 82424c0cdb | 2 years ago |
1 changed files with 37 additions and 0 deletions
@ -0,0 +1,37 @@
|
||||
## popint |
||||
|
||||
### Instructions |
||||
|
||||
Write a function that receives a slice of int and returns a new slice without the last element. If the slice is empty return an empty slice. |
||||
|
||||
### Expected function |
||||
|
||||
```go |
||||
func PopInt(ints []int) []int { |
||||
|
||||
} |
||||
``` |
||||
|
||||
### Usage |
||||
|
||||
Here is a possible program to test your function: |
||||
|
||||
```go |
||||
package main |
||||
|
||||
import "fmt" |
||||
|
||||
|
||||
func main() { |
||||
ints := []int{6, 7, 8, 9,} |
||||
l := PopInt(ints) |
||||
fmt.Println(l) |
||||
} |
||||
``` |
||||
|
||||
And its output: |
||||
|
||||
```console |
||||
$ go run . |
||||
[6 7 8] |
||||
``` |
Loading…
Reference in new issue