Unit 4 - Loops & Algorithms#

Topics#

  • for

  • while

  • do while

  • break, continue

Examples#

// return index of first occurrence of E
int findE(String s) {}

// return the number of Es in the string
int countE(String s) {}

// return sum 1 + ... + n
int sum(int n) {}

// return the String obtained by killing every other letter
String binimate(String s) {}

Demo#