Last active
July 31, 2020 14:04
-
-
Save KanzakiRanko1/b740c86113f9b7c24e162a6d078f7a29 to your computer and use it in GitHub Desktop.
Most obvious way to generate code to check if a number is even, duh.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Main { | |
| public static void main(String[] args) { | |
| boolean last; | |
| last = false; | |
| System.out.println("private bool IsEven(int number) {"); | |
| for (int i = 1; i <= Integer.MAX_VALUE; i++) { | |
| System.out.println(" %s if (number == %d) return %b;", int==1?"":"else", i, last); | |
| last = !last; | |
| } | |
| System.out.println("}"); | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run the script, pipe output to a file and you'll have an ideal even check function.