Skip to end of banner
Go to start of banner

Array Keys

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

Using a key/value pair allows you to create key-value lists (maps) and retrieve values from them by using a string inside the operator (instead of a number).

Example 1 - Adding values by key

string [] fruitColor;
fruitColor["Apple"] = "Red";
fruitColor["Banana"] = "Yellow";
fruitColor["Orange"] = "Orange";

Example 2 - Retrieving values by key

return fruitColor["Banana"];

  • No labels