Associative array/Creation: Difference between revisions

Add EasyLang
(FutureBasic solution added)
(Add EasyLang)
Line 2,747:
["one" => 2].diverge(String, float64) # mutable, initial contents,
# typed (coerces to float)</syntaxhighlight>
=={{header|EasyLang}}==
EasyLang does not really have associative arrays, but arrays of arrays type is a good substitute.
<syntaxhighlight lang="easylang">
associative$[][] = [ [ 1 "associative" ] [ 2 "arrays" ] ]
</syntaxhighlight>
And here are functions for indexing associative arrays:
<syntaxhighlight lang="easylang">
func indexAssoc index . array[][] item .
for i = 1 to len array[][]
if array[i][1] = index
item = array[i][2]
break 2
.
.
item = number "nan"
.
func indexStrAssoc index$ . array$[][] item$ .
for i = 1 to len array$[][]
if array$[i][1] = index$
item$ = array$[i][2]
break 2
.
.
item$ = ""
.
</syntaxhighlight>
 
=={{header|EchoLisp}}==
175

edits