Mwnci set() Function

Syntax

set(hash, key, value)

set(array, index, value)

Description

A hash is a key/value container, but not that keys may only be of type boolean, int, and string.

Updating a hash is done via the set() function, but note that this returns a new updated hash rather than changing in-place.

Updating an array or strings works in much the same way by using the index of each rather than a key value.

*This isn’t particularly efficient, and instructions s such as  a[10]=100  rather than a=set(a,10,100) are being worked on.

Example

a={"name":"mwnci",
           true:1,
           7:"seven"}
println(a)
a=set(a, 8, "eight")
a=set(a, "name", "derek")
println(a)

MyArray=[1,2,3,4]
MyArray=set(MyArray,0,6)
println(MyArray)

MyString="Fobar"
MyString=set(MyString,1,"u")
println(MyString)



{8: eight, true: 1, 7: seven, name: derek}
[6, 2, 3, 4]
Fubar