Jump to content

Singly-linked list/Traversal: Difference between revisions

(add FreeBASIC)
Line 645:
 
<lang dyalect>type List = List(value, tail) | Nil()
 
static func List.fromArray(xs) {
var list = List.Nil()
Line 657:
var xs = valueof(this)
while true {
yield xs.:value
if xs.:tail is Nil() {
break
}
xs = valueof(xs.:tail)
}
}
 
var xs = List.fromArray([1..10])
 
for x in xs {
print(x)
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.