Jump to content

Singly-linked list/Element removal: Difference between revisions

no edit summary
m (syntax highlighting fixup automation)
imported>Chinhouse
No edit summary
Line 1,079:
After 2nd removal : 1
</pre>
 
=={{header|MiniScript}}==
We're choosing here to use the built-in list type, rather than make our own from scratch, since this is more representative of how one is likely to actually use MiniScript.
<syntaxhighlight lang="miniscript">
> myList = range(100, 110)
> myList
[100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110]
> myList.pop // removes the last element
110
> myList
[100, 101, 102, 103, 104, 105, 106, 107, 108, 109]
> myList.pull // removes the first element
100
> myList
[101, 102, 103, 104, 105, 106, 107, 108, 109]
> myList.remove 5 // removes 106 at index 5
> myList
[101, 102, 103, 104, 105, 107, 108, 109]
</syntaxhighlight>
 
 
=={{header|Nim}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.