nextMultipleOfN function

int? nextMultipleOfN(
  1. int? input,
  2. int? n
)

Rounds input up to the next nth, if necessary.

Implementation

int nextMultipleOfN(int input, int n) =>
    (input % n != 0) ? (input ~/ n + 1) * n : input;