Your challenge is to write a polyglot that works in different versions of your language. When run, it will always output the language version.
- Your program should work in at least two versions of your language.
- Your program's output should only be the version number. No extraneous data.
- Your program may use whatever method you like to determine the version number. However, the output must follow rule 2; however you determine the version number, the output must only be the number.
- Your program only needs to output the major version of the language. For example, in FooBar 12.3.456789-beta, your program would only need to output 12.
- If your language puts words or symbols before or after the version number, you do not need to output those, and only the number. For example, in C89, your program only needs to print
89, and in C++0x, your program only needs to print
- If you choose to print the full name or minor version numbers, e.g. C89 as opposed to C99, it must only print the name.
C89 build 32is valid, while
error in C89 build 32: foo baris not.
- Your program may not use a builtin, macro, or custom compiler flags to determine the language version.
Your score will be the code length divided by the number of versions it works in. Lowest score wins, good luck!