forked from root/public
estlop
2 years ago
committed by
Dav Hojt
1 changed files with 39 additions and 0 deletions
@ -0,0 +1,39 @@ |
|||||||
|
## popint |
||||||
|
|
||||||
|
### Instructions |
||||||
|
|
||||||
|
Write a function that receives a slice of int and returns a new slice without the last element. |
||||||
|
|
||||||
|
### Expected function |
||||||
|
|
||||||
|
```go |
||||||
|
func PopInt(ints []int) []int { |
||||||
|
|
||||||
|
} |
||||||
|
``` |
||||||
|
|
||||||
|
### Usage |
||||||
|
|
||||||
|
Here is a possible program to test your function: |
||||||
|
|
||||||
|
```go |
||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"piscine" |
||||||
|
"fmt" |
||||||
|
) |
||||||
|
|
||||||
|
func main() { |
||||||
|
ints := {6,7,8,9,} |
||||||
|
l := piscine.PopInt(ints) |
||||||
|
fmt.Println(l) |
||||||
|
} |
||||||
|
``` |
||||||
|
|
||||||
|
And its output: |
||||||
|
|
||||||
|
```console |
||||||
|
$ go run . |
||||||
|
[6 7 8] |
||||||
|
``` |
Loading…
Reference in new issue