Doubly-linked list/Element definition: Difference between revisions
Doubly-linked list/Element definition (view source)
Revision as of 12:06, 12 November 2020
, 3 years ago→{{header|Wren}}: Rewrote this as the task is about element definition rather than the definition of the doubly-linked list itself.
(Added Wren) |
(→{{header|Wren}}: Rewrote this as the task is about element definition rather than the definition of the doubly-linked list itself.) |
||
Line 1,005:
=={{header|Wren}}==
{{libheader|Wren-llist}}
The
<lang ecmascript>import "/llist" for
var
dn1.next = dn2
dn1.prev = null
dn2.prev = dn1
dn2.next = null
System.print(["node 1", "data = %(dn1.data)", "prev = %(dn1.prev)", "next = %(dn1.next)"])
System.print(["node 2", "data = %(dn2.data)", "prev = %(dn2.prev)", "next = %(dn2.next)"])</lang>
{{out}}
<pre>
[node 1, data = 1, prev = null, next = 2]
[node 2, data = 2, prev = 1, next = null]
</pre>
|