Functions argument

Another option is to simply declare variables a & b in the global context. :globe_with_meridians:
Which in Java terms they’d be known as fields. :coffee:

int a, b;

void example(final char ch) {
  if (ch == 'y') {
    a *= b;
    b = (a + 5) * (b - 2);
  } else {
    b /= a;
    a += b;
  }
}
3 Likes