Take the 2-minute tour ×
Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It's 100% free, no registration required.

This question already has an answer here:

Your program should print out just another <LANG> hacker where <LANG> is replaced by whatever language you are running in. Your program must run in at least two different languages, and print out differently in each obviously.

Edit: I've changed the rules slightly so as not to be a dupe of Write a polyglot that prints the language's name. You do not have to print out only the just another <LANG> hacker text. You may also print out anything else you want as long as just another <LANG> hacker appears somewhere in your output.


  • Two versions of a language only count separately if the following conditions hold:

    • You print out the version in each one.
    • You detect which version is running by a less trivial way than running a ver() function or comparable in whatever lang it is.
    • The two have different major version numbers and substantial syntax differences.
  • You may not have any errors on the maximum level of warning in any of the languages.

  • Program must terminate.


  • Whatever answer supports the most languages. In case of a tie, the shorter answer.
share|improve this question

marked as duplicate by Howard, Gareth, Johannes Kuhn, Quincunx, syb0rg Dec 31 '13 at 1:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Why the 'maximum level of warning'? That seems rather harsh. –  marinus Dec 30 '13 at 21:10
I think this is sufficiently separate from those. –  Timtech Dec 31 '13 at 0:04
1) Please don't write your question starting with what's it's almost like, then what to change to make it the question (or, in your case, initial idea, then edit), it's really a pain to read. 2) It's still the same challenge as the question marked as duplicate. –  J B Dec 31 '13 at 21:11

6 Answers 6

C, C++, Perl, Bash – 230

#include <stdio.h>
#define c const char*\
s="just another %s hacker\n"
//bin/test;printf "$s" Bash;exit
int main(){c;printf(s,sizeof'a'-1?"C":"C++");}
/*==;seek DATA,0,0;@a=readline DATA;eval'$'.$a[2];printf $s,"Perl";

This was fun! :-)

230 chars including a newline at end of file. To run, save as both poly.c and poly.cpp and do:

$ gcc -Wall -Wextra -pedantic poly.c && ./a.out 
just another C hacker
$ g++ -Wall -Wextra -pedantic poly.cpp && ./a.out 
just another C++ hacker
$ perl poly.c
just another Perl hacker
$ bash poly.c
just another Bash hacker
share|improve this answer
This generates warnings when run with perl -w, and doesn't compile at all with -Mstrict. –  Ilmari Karonen Dec 30 '13 at 22:04

Windows Batch, TI-Basic, Golf-Basic 84, and Quomplex

::¤"just another Quomplex hacker"¤:"'*[]'"
echo just another Windows Batch hacker

How it works

Windows Batch was the easiest, because :: starts a comment. Fairly simple to implement.

TI-Basic doesn't support lowercase letters or backticks, causing it to skip the statements d"JUST ANOTHER GOLF-BASIC 84 HACKER":g1 (backticks removed), which Golf-Basic evaulates, Displaying the message and forwarding to Label 1, where it is promptly ended.

Quomplex was snuck in at the beginning because its complex syntax won't allow for much to be skipped. All it does is add "just another Quomplex hacker" to the output, and then for the mastery of the program...

The Mastery of the Programming Syntax


Pure genius. Quomplex ignores : and takes "' and '" as strings, leaving it to output the stack and perish in an infinite while loop ([]). Meanwhile, Golf-Basic and TI-Basic take the whole "'*[]'" as a string, because ' is a mathematical operator, not a string operator.

share|improve this answer


#ifdef __cplusplus
#    include <iostream>
#    define LANG "C++"
#    define PRINT(text) { std::cout << text; }
#    include <stdio.h>
#    define LANG "C"
#    define PRINT(text) { printf("%s", text); }

int main(void) {
    PRINT("just another ");
    PRINT(" hacker\n");

    return 0;

Compiling and executing:

$ gcc -ansi -Wall -Wextra -pedantic -o prog-c prog.c
$ ./prog-c
just another C hacker
$ g++ -ansi -Wall -Wextra -pedantic -o prog-cpp prog.c
$ ./prog-cpp
just another C++ hacker
share|improve this answer

BASH + BrainF*ck + PHP, 269 characters

#><?="Just another PHP hacker\n";die();?><
echo Just another BASH hacker #++++++++++[>+++++++>++++++++++++>++++++++++>+++++++++++>+++>+<<<<<<-]>++++.>---.--.+.>>>++.<<---.>.+.<<.>+++++++.---.>+++.>.<<<<<++++[>--<-]>.++++.>>>>.<<+++.-------.++.>-------.<++.>+++++++.>>.

Running the program:

$ php langs.sh 
#>Just another PHP hacker
$ ./2langs.sh
Just another BASH hacker
$ bf 2langs.sh
Just another BF hacker

A bit of stretching the rules with that PHP one, but it seems to work. I can fix it if it doesn't count.

share|improve this answer
One could possibly argue this is invalid because the language name is Brainfuck and not BF. –  nyuszika7h Dec 30 '13 at 22:28
@nyuszika7h It's commonly abbreviated that way. google.com/search?q=BF+programming –  Tyzoid Dec 30 '13 at 22:54
True, I don't want to be the one deciding this, but it wasn't specified so... –  nyuszika7h Dec 31 '13 at 11:00

JavaScript, HTML, BF

    // > to fix previous comment delim
    alert('Just another JavaScript hacker')
// --> Just another HTML hacker

Relies on the fact that most JS implementations ignore <!--.

BF code shamelessly stolen from @Tyzoid, all credit to him :-)

Make sure your BF interpreter supports pointer wrapping.

share|improve this answer
Careful! The first < will make your BrainF*ck program crash! –  Tyzoid Dec 31 '13 at 0:13
Yea, invalid... –  Timtech Dec 31 '13 at 0:46
@Tyzoid Oops, didn't notice :-P fixed –  Doorknob Dec 31 '13 at 1:34
@DoorknobofSnow It's still not fixed. The problem is that BF starts on element zero on the tape, and does not allow a < to move you to element -1. It crashes before it hits your fix. It's the same problem I'm having with my PHP solution. –  Tyzoid Dec 31 '13 at 3:01
@Tyzoid I mentioned that - "Make sure your BF interpreter supports pointer wrapping." –  Doorknob Dec 31 '13 at 9:44

Lua 5.3/5.2/5.1/5.0/4.0/3.2

You said as long as I don't use _VERSION it is fine

print("Just another Lua"..(string and(loadstring"return 0//0"and"5.3"or(_ENV and"5.2"or(string.gmatch and"5.1"or"5.0")))or tremove(next({[{"4.0","3.2"}]=1},nil))).." hacker")
share|improve this answer
I don't know about Lua, but they must also have different version numbers and major syntax differences. –  Juan Sebastian Lozano Muñoz Dec 31 '13 at 1:49
Well the question did not state the majorness of the syntactical differences. After all, C/C++ entries are valid –  mniip Dec 31 '13 at 1:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.