From 0c3454c9f9eb0f3033fff0cc477a0211b2c4007b Mon Sep 17 00:00:00 2001 From: Augusto Date: Tue, 25 Jun 2019 16:59:06 +0100 Subject: [PATCH] add test for the head and tail in the readme of listreverse --- subjects/listreverse.en.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/subjects/listreverse.en.md b/subjects/listreverse.en.md index bbe15d797..f661ef477 100644 --- a/subjects/listreverse.en.md +++ b/subjects/listreverse.en.md @@ -45,10 +45,15 @@ func main() { piscine.ListReverse(link) - for link.Head != nil { - fmt.Println(link.Head.Data) - link.Head = link.Head.Next + it := link.Head + + for it != nil { + fmt.Println(it.Data) + it = it.Next } + + fmt.Println("Tail", link.Tail) + fmt.Println("Head", link.Head) } ``` @@ -61,5 +66,7 @@ student@ubuntu:~/piscine/test$ ./test 3 2 1 +Tail &{1 } +Head &{4 0xc42000a140} student@ubuntu:~/piscine/test$ -``` +``` \ No newline at end of file