Skip to content

Instantly share code, notes, and snippets.

@dbushenko
Last active September 8, 2021 05:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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