Singly-linked list/Element definition: Difference between revisions

Content added Content deleted
imported>Dlesnoff
(→‎{{header|Nim}}: Fix type mismatch due to a now necessary dollar sign Add strutils as import)
Line 1,020: Line 1,020:


=={{header|Nim}}==
=={{header|Nim}}==
<syntaxhighlight lang="nim">type
<syntaxhighlight lang="nim">
import std/strutils # for join


type
Node[T] = ref object
Node[T] = ref object
next: Node[T]
next: Node[T]
Line 1,066: Line 1,068:
for i in 1..5: list.append(i)
for i in 1..5: list.append(i)
for i in 6..10: list.prepend(i)
for i in 6..10: list.prepend(i)
echo "List: ", list</syntaxhighlight>
echo "List: ", $list
</syntaxhighlight>


{{out}}
{{out}}