|
|
|
|
|
by Joker_vD
1749 days ago
|
|
Those v += 1 implement the exact specification given above: 1. Parse an integer N from a string.
2. If N is NaN, fail with an error. Otherwise, increment N by 1.
3. If N is > 3, fail with an error. Otherwise, increment N by 1.
4. If steps 1-3 failed, set N to 3.
5. Increment N by 1.
Those are quite strange requirements, and the resulting second code looks strange too, but... it faithfully and obviously correctly represents the given specification. |
|
Thank you for the comments. I've learned more from reading the comments.