Skip to content

Instantly share code, notes, and snippets.

@dbushenko
Last active September 8, 2021 05:25
Show Gist options
  • Save dbushenko/7de1543882b25d45906e7674f6efaaea to your computer and use it in GitHub Desktop.
Save dbushenko/7de1543882b25d45906e7674f6efaaea to your computer and use it in GitHub Desktop.
// mutable i
//
int i = 0;
while (something() > 0) {
i++;
}
// immutable i
//
int countWhileSomething(final int i) {
if (! (something() > 0) ) {
return i;
} else {
countWhileSomething(i + 1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment