Pragma: UseUtils

BeginProgram: Maps3

BeginFunction: {<string>|<int>} convertKMtoMiles({<string>|<int>} x)
	MapDecl: {<string>|<int>} y
	BeginForEach: auto planet in mapkeys(x)
		Assign: y{planet} = int(Double(x{planet}) * 0.621371 + 0.5)
	EndForEach
	Return: y
EndFunction

BeginMain:
	MapDecl: {<string>|<int>} planetDiametersInKM :=
		"Mercury" => 4879,
		"Venus" => 12103,
		"Earth" => 12756,
		"Mars" => 6794,
		"Jupiter" => 142985,
		"Saturn" => 120534,
		"Uranus" => 51115,
		"Neptune" => 49534,
		"Pluto" => 2374,
		"Ceres" => 946,
		"Eris" => 2326,
		"Makemake" => 1430
	EndMapDecl

	MapDecl: {<string>|<int>} planetDiametersInMiles = convertKMtoMiles(planetDiametersInKM)
	BeginForEach: auto planet in mapkeys(planetDiametersInMiles)
		PrintLine: planet, " has a diameter of ", planetDiametersInMiles{planet}, " miles"
	EndForEach
EndMain
EndProgram
