Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 318 Bytes

File metadata and controls

17 lines (14 loc) · 318 Bytes

Iterate over a String

This general pattern of counting up and counting down becomes especially useful when you want to iterate over each character in a String.

~void main() {
String name = "Avril";

int index = 0;
while (index < name.length()) {
    IO.println(name.charAt(index));
    index++;
}
~}