Skip to end of banner
Go to start of banner

Array Values

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

Version 1 Next »

Any variable type can be transformed into an array by adding the array symbols [] after the type declaration.

Example 1 - Adding values by index

string [] fruit;
fruit[0] = "Apple";
fruit[1] = "Apricot";
fruit[3] = "Banana";

Example 2 - Adding values to next position

string [] fruit;
fruit += "Apple";
fruit += "Apricot";
fruit += "Banana";

Example 3 - Retrieving a value

return fruit[1];

  • No labels