> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/sidef-lang/programming_tasks/s/singly-linked-list/element_insertion.md).

# Element insertion

```ruby
func insert_after(a,b) {
    b{:next} = a{:next}
    a{:next} = b
}
 
var B = Hash(
    data => 3,
    next => nil,    # not a circular list
)
var A = Hash(
    data => 1,
    next => B,
)
var C = Hash(
    data => 2,
)
 
insert_after(A, C)
```
