User Tools

Site Tools


en:maps

This is an old revision of the document!


Maps

Maps, also known ad dictionaries in Python, are created using the Map statement. They may hold numeric or string data. Access to specific elements in a map is accomplished by using square brackets along with the string key associated with the element.

You may use the Array length [?] operator or the Length function.

Internally maps are stores in alphabetic order. You may easily loop through a map using the For Next statement.

map grades

grades['bob'] = 90
grades['mary'] = 96
grades['jimmy'] = 76

total = 0
foreach name in grades
	? name, grades[name]
	total = total + grades[name]
next name

? "the class average is", total/length(grades)

displays <code> bob 90 jimmy 76 mary 96 the class average is 87.3333333333 </code> ==== History ==== |2.0.0.0|New to version|

en/maps.1587676939.txt.gz · Last modified: 2020/04/23 15:22 by admin