Answer the question
In order to leave comments, you need to log in
How to work with a dynamic list in GO?
The code below throws an error:
invalid operation: x < e.Value (operator < not defined on interface)
package main
import (
"container/list"
"fmt"
)
func main() {
var l list.List
l.PushBack(1)
l.PushBack(2)
l.PushBack(3)
l.PushBack(4)
x := 2
for e := l.Front(); e != nil; e = e.Next() {
if x < e.Value {
fmt.Println(e.Value)
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question