Add Type to Ruby!
This project is maintained by S-H-GAMELINKS
Tatara::StringIntMap
is Map
class like static type programming lang
.
Tatara::StringIntMap
used by String
key, and Integer
value.
But, you can use Float
and Integer
for value.
@i = Tatara::StringIntMap.new
@i["A"] = 42
# => Key: "A", Value: 42.
@i["B"] = 8.4
# => Key: "B", Value: 8.
But, can not use Integer
& Float
for key.
@i = Tatara::StringIntMap.new
@i[42] = 42
# => Error!
@i[4.2] = 4.2
# => Error!
Create new Tatara::StringIntMap
instance.
@i = Tatara::StringIntMap.new
Access by key.
@i = Tatara::StringIntMap.new
@i["A"] = 42
puts @i["A"]
# => 42
Set value by key.
@i = Tatara::StringIntMap.new
@i["A"] = 42
# => Set value is 42.
Set key & value.
@i = Tatara::StringIntMap.new
@i.insert("A", 42)
# => Set value is 42.