Skip to content

Latest commit

 

History

History
17 lines (13 loc) · 422 Bytes

File metadata and controls

17 lines (13 loc) · 422 Bytes

Length

The number of elements which comprise an array can be accessed by using .length.1

~void main() {
String[] veggies = { "brussels", "cabbage", "carrots" };
int numberOfElements = veggies.length;

// veggies is 3 elements long
IO.println(
    "veggies is " + numberOfElements + " characters long"
);
~}

Footnotes

  1. Unlike with a String, you do not write () after .length.