Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Challenge:

In the programming language of your choice, take no input and output your programming languages name.

Fair enough, right?

Restrictions:

  • You can't use any character that is included in your programming language's name in your code. E.g., if I wanna use Batch, I must not use the chars 'B' 'a' t' 'c' 'h' in my code. Note that this is case sensitive. I can still use the char 'b' because it's different from 'B'.
  • You can have "junk output" before or after the name of the language
  • Version number doesn't count as part of the name of the language. E.g., I can use the number 3 in the code in my answer if it's in Python 3
  • The output of the programming language name is not case sensitive.
  • Brute-forcing all possible letter combinations and hoping you get your language name is forbidden.

Example outputs: (let's say my programming language is called Language) (✔ if valid, else ✖)

  • Language
  • Body language is a type of non-verbal communication in which physical behavior, as opposed to words, is used to express or convey information. Such behavior includes facial expressions, body posture, gestures, eye movement, touch and the use of space.
  • Language 2.0 - © 1078 AD some company
  • foobar

This is thus shortest code wins.

share|improve this question
1  
The rule about case sensitive restrictions is very ambiguous. Which is the correct orthography: BASIC Basic or basic? I'm pretty sure I can find examples for all three. – Level River St 7 hours ago
2  
Obligatory "Just having your code be blank but have a flag like --version isn't allowed"? – Value Ink 7 hours ago
8  
Have case-insensitive output while banning the language name case-sensitively allows boring solutions that just output the language name case-swapped. – xnor 6 hours ago

32 Answers 32

MATL, 1 byte

Y

Output is through STDERR, which is allowed by default.

The output from the offline compiler is

Error using matl_parse (line 339)
MATL error while parsing: Y not recognized at position 1
Error in matl (line 234)
    S = matl_parse(s, useTags); 

Or try it online! (expand "debug" section).

share|improve this answer

Outputs to STDERR

Outputting to STDERR is now at +33/-21 as an allowed default, which is positive but contested. This is a CW answer to collect answers that just invoke an error in a language where error messages includes the language name.

Haskell, 1 byte

1

Error:

Parse error: naked expression at top level
Perhaps you intended to use TemplateHaskell

Lua, 1 byte

1

Error:

lua: .code.tio:1: syntax error near <eof>

(file name is unimportant)

Batch, 1 byte

~

Error:

'~' is not recognized as an internal or external command,
operable program or batch file.

tinylisp, 5 bytes

(c()1

Error:

Error: cannot cons to non-list in tinylisp
share|improve this answer

HTML, 24 20 bytes

&#72;&#84;&#77;&#76;


HTML, 16 bytes

As pointed out by @Bob, modern browsers will recognize HTML entities without semicolons, though it's technically invalid HTML. Of course, it's perfectly valid for code golf.

&#72&#84&#77&#76


Also, see my CSS answer.

share|improve this answer
1  
You can save four characters by using decimal instead: &#72;&#84;&#77;&#76;. You can save an additional four characters by dropping the semicolons, at the cost of being technically invalid HTML (but still working in modern browsers). – Bob 3 hours ago
    
@Bob Thanks for the tips! – darrylyeo 3 hours ago

V, 2 bytes

¬U

Try it online!

The obvious answer is:

év~

Try it online!

Which is "Insert the letter 'v', and toggle case". However, since you allow for junk output before/after the language name, this works too.

The ¬ command takes two characters for input, and inserts every ASCII character between them. If we don't supply the second character, it automatically defaults to ÿ (ASCII 0xff), so this program inserts every character in the latin1 encoding between U and ÿ.

share|improve this answer

bash, 11

echo $SHELL

Outputs /bin/bash

share|improve this answer
    
echo $0 should work – squeamish ossifrage 5 hours ago
    
@squeamishossifrage That works at the shell command line, but in a script it will output the name of the script. – Digital Trauma 16 secs ago

SmileBASIC, 11 bytes

sPsET.,1474

Eqivilant to SPSET 0,1474. Sets sprite 0 to definition 1474, which is the SmileBASIC logo.

Screenshot

share|improve this answer

MATLAB, 3 bytes

ver

Output is as follows. Irrelevant info has been replaced by [...]). Some parts of the output may change depending on version, installed toolboxes etc.

-----------------------------------------------------------------------------------------
MATLAB Version: 8.6.0.267246 (R2015b)
MATLAB License Number: [...]
Operating System: [...]
Java Version: Java 1.7.0_60-b19 with [...]
-----------------------------------------------------------------------------------------
MATLAB                                                Version 8.6         (R2015b)
Communications System Toolbox                         Version 6.1         (R2015b)
Curve Fitting Toolbox                                 Version 3.5.2       (R2015b)
[...]
Wavelet Toolbox                                       Version 4.15        (R2015b)
share|improve this answer
    
Uses a v and an e – Jack Bates 6 hours ago
    
Your language is Octave, so you can't use v and e. – JungHwan Min 6 hours ago
1  
Woops. Corrected by changing language to Matlab (which was my initial intent anyway) – Luis Mendo 6 hours ago

Octave, 3 2 bytes

qz

Results in the following error message

 -- LAMBDA = qz (A, B)
 -- LAMBDA = qz (A, B, OPT)

Additional help for built-in functions and operators is
available in the online version of the manual.  Use the command
'doc <topic>' to search the manual index.

Help and information about Octave is also available on the WWW
at http://www.octave.org and via the [email protected]
mailing list.
share|improve this answer

C 24 20 Bytes (Clang 3.8.1)

Thanks to @squeamish ossifrage for helping me save 4 bytes.

main(){putchar(67);}
share|improve this answer
    
How about putchar(67);? – squeamish ossifrage 5 hours ago
    
@squeamishossifrage yep, thanks – Wade Tyler 5 hours ago

R, 11 bytes

cat("\x52")

Try it online!

share|improve this answer

Python 2, 25 bytes

exec"pri\156\164'pYTHON'"

Try it online!

Prints pYTHON. Uses octal codes for the banned characters n and t.

If functions are allowed, we can just do:

lambda:"pYTHON"
share|improve this answer
    
Very nice! Of course, I have bias towards my import this solution for the creativity factor, but you can take the shorter answer :P – Value Ink 6 hours ago

Ruby, 18 16 7 bytes

Feels like cheating to be able to use different cases, but OK sure

The language can be case-insensitive??? Wow

p"rUBY"
share|improve this answer

Python, 27 53 49 48 bytes

exec eval('"IMpORT THIS"'+'.LOWER()'.swapcase())

Prints the following text, which has "Python" on the first line.

The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
share|improve this answer
1  
@Arnauld fixed! – Value Ink 6 hours ago

PHP, 13 bytes

<?=phpinfo();

Returns a lot of information, including a line such as:

PHP Version => 7.0.10
share|improve this answer

Pushy, 19 bytes

80 117 115 104 121"

Each number is pushed to the stack

Then the " interprets the whole stack as Unicode characters and prints it

share|improve this answer

CJam, 8 6 bytes

"cjAM"

Try it online!

Old version

"BI`l":)

Try it online!

"BI`l"    e# Push this string
:)        e# Add 1 to the code point of each char. Implicitly display
share|improve this answer

Python 3, 28 17 bytes

exec("\150elp()")

It concatenates the strings uses the octal 150 which is h and "elp()" and runs the result. This prints the help() command which says "Welcome to Python 3.5's help utility!", meeting the requirements.

share|improve this answer
    
Not sure help counts, it only works in a REPL environment. – xnor 5 hours ago
    
It still prints out the Python. That's all that's required. – Jack Bates 5 hours ago
    
If it works in TIO surely it's a valid answer? – Jack Bates 5 hours ago
    
Never mind, I was mistaken and it works as a program. Sorry about that. – xnor 5 hours ago

Python 2, 15 bytes

exec"\150elp()"

Takes part of my Python 3 answer and @xnor answer to make this

share|improve this answer

GNU CLISP (2.49+, on Cygwin) (5 or 6 bytes)

'clisp (6 bytes)

Outputs:

CLISP

(answer based on quote usage in http://codegolf.stackexchange.com/a/89234/59547 )

If you reduce it to

clisp (5 bytes)

you can get the error

*** - SYSTEM::READ-EVAL-PRINT: variable CLISP has no value....
share|improve this answer

JAVA, 1 byte

1

The output to stderr is:

Main.java:1: error: class, interface, or enum expected
1
^
1 error
Error: Could not find or load main class Main
Command exited with non-zero status 1
    Command being timed: "/srv/wrappers/java-openjdk"
    User time (seconds): 1.40
    System time (seconds): 0.80
    Percent of CPU this job got: 40%
    Elapsed (wall clock) time (h:mm:ss or m:ss): 0:05.40
    Average shared text size (kbytes): 0
    Average unshared data size (kbytes): 0
    Average stack size (kbytes): 0
    Average total size (kbytes): 0
    Maximum resident set size (kbytes): 44564
    Average resident set size (kbytes): 0
    Major (requiring I/O) page faults: 205
    Minor (reclaiming a frame) page faults: 11301
    Voluntary context switches: 2666
    Involuntary context switches: 1677
    Swaps: 0
    File system inputs: 78312
    File system outputs: 0
    Socket messages sent: 0
    Socket messages received: 0
    Signals delivered: 0
    Page size (bytes): 4096
    Exit status: 1 
share|improve this answer
    
This is output from compilation, rather than running the program. I don't know whether this is allowed by default. – CAD97 51 mins ago

Invalid processing 53 bytes

The edited is not part of the name

Edited version of processing (didn't cheat by making my own version) https://github.com/Khan/processing-js

println("p".toUpperCase()+"ROCESSING".toLowerCase());
share|improve this answer
    
I believe the official name is "Processing.js". Also, this uses r, o, e, s, i, and n, which I believe makes it invalid. – ETHproductions 6 hours ago
    
Oh wow. that makes it a lot harder then I thought – Christopher Peart 6 hours ago

JavaScript (ES6), 29 45 bytes

There's probably a better way.

let f =

_=>'\x4A\x61\x76\x61\x53\x63\x72\x69\x70\x74'

console.log(f())

share|improve this answer
    
@ETHproductions This turns out to be more complicated than I expected. Here is a fixed (but weak) version. – Arnauld 6 hours ago
    
Huh, none of the hex values contain a letter, except for J. Perhaps that could be useful in some way (though I highly doubt it...) – ETHproductions 6 hours ago
    
Abuse case-insensitive requirements for output to print jAVAsCRIPT? – Value Ink 6 hours ago
    
@ValueInk I supposed I could do that but I actually wish this rule didn't exist. It kinda ruins the game. – Arnauld 6 hours ago
    
How about just _=>'\x45\x53'+(5+1)? It is technically ECMAScript6 – Flambino 5 hours ago

dc, 6

25699P

Outputs dc.

Try it online.

share|improve this answer

RProgN, 19 Bytes.

~(70811.911.)71.+c.

Nice and easy! This was the first time (I think) I've gotten to use Stack Constructors in a challenge!

Explanation

~(70811.911.)71.+c.
~                   # Start a Zero Space Segment
 (          )       # Push a Stack
  7                 # Literal Numbers, the . concatenates two digits to form a single number.
   0                #
    8               #
     11.            #
        9           #
         11.        #
             71.+   # Add 71 to every value in the stack.
                 c. # Convert to their char values. Although this stack is configured 'backwards', when . is called, the stack concatenation works backwards. That's just how RProgN does it.
                    # Print is implicit.

Try it online!

Boring Cheaty Way

`rpROGn

Because the text output isn't case sensitive but the characters is...

share|improve this answer

Vim, 3 bytes

:h<CR>

This opens up the default help file and outputs:

*help.txt*  For Vim version 7.4.  Last change: 2016 Mar 31

                        VIM - main help file
                                                                         k
      Move around:  Use the cursor keys, or "h" to go left,        h   l
                    "j" to go down, "k" to go up, "l" to go right.   j
Close this window:  Use ":q<Enter>".
   Get out of Vim:  Use ":qa!<Enter>" (careful, all changes are lost!).

Jump to a subject:  Position the cursor on a tag (e.g. |bars|) and hit CTRL-].
   With the mouse:  Double-click the left mouse button on a tag, e.g. |bars|.
        Jump back:  Type CTRL-T or CTRL-O.  Repeat to go further back.

Get specific help:  It is possible to go directly to whatever you want help
                    on, by giving an argument to the |:help| command.
                    Prepend something to specify the context:  *help-context*

                          WHAT          PREPEND    EXAMPLE  ~
                      Normal mode command          :help x
                      Visual mode command     v_       :help v_u
                      Insert mode command     i_       :help i_<Esc>
                      Command-line command    :    :help :quit
                      Command-line editing    c_       :help c_<Del>
                      Vim command argument    -    :help -r
                      Option              '    :help 'textwidth'
                      Regular expression      /    :help /[
                    See |help-summary| for more contexts and an explanation.

  Search for help:  Type ":help word", then hit CTRL-D to see matching
                    help entries for "word".
                    Or use ":helpgrep word". |:helpgrep|

VIM stands for Vi IMproved.  Most of VIM was made by Bram Moolenaar, but only
through the help of many others.  See |credits|.
------------------------------------------------------------------------------
                                                *doc-file-list* *Q_ct*
BASIC:
|quickref|  Overview of the most common commands you will use
|tutor|     30 minutes training course for beginners
|copying|   About copyrights
|iccf|      Helping poor children in Uganda
|sponsor|   Sponsor Vim development, become a registered Vim user
|www|       Vim on the World Wide Web
|bugs|      Where to send bug reports

USER MANUAL: These files explain how to accomplish an editing task.

|usr_toc.txt|   Table Of Contents

Getting Started ~
|usr_01.txt|  About the manuals
|usr_02.txt|  The first steps in Vim
|usr_03.txt|  Moving around
|usr_04.txt|  Making small changes
|usr_05.txt|  Set your settings
|usr_06.txt|  Using syntax highlighting
|usr_07.txt|  Editing more than one file
|usr_08.txt|  Splitting windows
|usr_09.txt|  Using the GUI
|usr_10.txt|  Making big changes
|usr_11.txt|  Recovering from a crash
|usr_12.txt|  Clever tricks

Editing Effectively ~
|usr_20.txt|  Typing command-line commands quickly
|usr_21.txt|  Go away and come back
|usr_22.txt|  Finding the file to edit
|usr_23.txt|  Editing other files
|usr_24.txt|  Inserting quickly
|usr_25.txt|  Editing formatted text
|usr_26.txt|  Repeating
|usr_27.txt|  Search commands and patterns
|usr_28.txt|  Folding
|usr_29.txt|  Moving through programs
|usr_30.txt|  Editing programs
|usr_31.txt|  Exploiting the GUI
|usr_32.txt|  The undo tree

Tuning Vim ~
|usr_40.txt|  Make new commands
|usr_41.txt|  Write a Vim script
|usr_42.txt|  Add new menus
|usr_43.txt|  Using filetypes
|usr_44.txt|  Your own syntax highlighted
|usr_45.txt|  Select your language


REFERENCE MANUAL: These files explain every detail of Vim.  *reference_toc*

General subjects ~
|intro.txt| general introduction to Vim; notation used in help files
|help.txt|  overview and quick reference (this file)
|helphelp.txt|  about using the help files
|index.txt| alphabetical index of all commands
|help-tags| all the tags you can jump to (index of tags)
|howto.txt| how to do the most common editing tasks
|tips.txt|  various tips on using Vim
|message.txt|   (error) messages and explanations
|quotes.txt|    remarks from users of Vim
|develop.txt|   development of Vim
|debug.txt| debugging Vim itself
|uganda.txt|    Vim distribution conditions and what to do with your money

Basic editing ~
|starting.txt|  starting Vim, Vim command arguments, initialisation
|editing.txt|   editing and writing files
|motion.txt|    commands for moving around
|scroll.txt|    scrolling the text in the window
|insert.txt|    Insert and Replace mode
|change.txt|    deleting and replacing text
|indent.txt|    automatic indenting for C and other languages
|undo.txt|  Undo and Redo
|repeat.txt|    repeating commands, Vim scripts and debugging
|visual.txt|    using the Visual mode (selecting a text area)
|various.txt|   various remaining commands
|recover.txt|   recovering from a crash

Advanced editing ~
|cmdline.txt|   Command-line editing
|options.txt|   description of all options
|pattern.txt|   regexp patterns and search commands
|map.txt|   key mapping and abbreviations
|tagsrch.txt|   tags and special searches
|quickfix.txt|  commands for a quick edit-compile-fix cycle
|windows.txt|   commands for using multiple windows and buffers
|tabpage.txt|   commands for using multiple tab pages
|syntax.txt|    syntax highlighting
|spell.txt| spell checking
|diff.txt|  working with two to four versions of the same file
|autocmd.txt|   automatically executing commands on an event
|filetype.txt|  settings done specifically for a type of file
|eval.txt|  expression evaluation, conditional commands
|fold.txt|  hide (fold) ranges of lines

Special issues ~
|print.txt| printing
|remote.txt|    using Vim as a server or client
|term.txt|  using different terminals and mice
|digraph.txt|   list of available digraphs
|mbyte.txt| multi-byte text support
|mlang.txt| non-English language support
|arabic.txt|    Arabic language support and editing
|farsi.txt| Farsi (Persian) editing
|hebrew.txt|    Hebrew language support and editing
|russian.txt|   Russian language support and editing
|ft_ada.txt|    Ada (the programming language) support
|ft_sql.txt|    about the SQL filetype plugin
|rileft.txt|    right-to-left editing mode

GUI ~
|gui.txt|   Graphical User Interface (GUI)
|gui_w32.txt|   Win32 GUI

Interfaces ~
|if_cscop.txt|  using Cscope with Vim
|if_pyth.txt|   Python interface
|if_ruby.txt|   Ruby interface
|debugger.txt|  Interface with a debugger
|sign.txt|  debugging signs

Versions ~
|vim_diff.txt|  Main differences between Nvim and Vim
|vi_diff.txt|   Main differences between Vim and Vi
                                                *sys-file-list*
Remarks about specific systems ~
|os_win32.txt|  MS-Windows
                                                *standard-plugin-list*
Standard plugins ~
|pi_gzip.txt|      Reading and writing compressed files
|pi_netrw.txt|     Reading and writing files over a network
|pi_paren.txt|     Highlight matching parens
|pi_tar.txt|       Tar file explorer
|pi_vimball.txt|   Create a self-installing Vim script
|pi_zip.txt|       Zip archive explorer

LOCAL ADDITIONS:                *local-additions*

------------------------------------------------------------------------------
*bars*      Bars example

Now that you've jumped here with CTRL-] or a double mouse click, you can use
CTRL-T, CTRL-O, g<RightMouse>, or <C-RightMouse> to go back to where you were.

Note that tags are within | characters, but when highlighting is enabled these
characters are hidden.  That makes it easier to read a command.

Anyway, you can use CTRL-] on any word, also when it is not within |, and Vim
will try to find help for it.  Especially for options in single quotes, e.g.
'hlsearch'.

------------------------------------------------------------------------------
 vim:tw=78:fo=tcq2:isk=!-~,^*,^\|,^\":ts=8:ft=help:norl:

For whatever reason, this doesn't work on TIO. I'm not sure why, but it doesn't affect the validity of this answer since V is a different language.

share|improve this answer

BASIC (ZX Spectrum), 4 bytes

õ°""

Note: In the ZX Spectrum character set, these bytes display as

PRINT VAL ""

which outputs

C Nonsense in BASIC, 0:1

because the empty string is not a valid numeric expression. (I could of course have used any statement that takes a single integer.) If this answer is unacceptable, then for 6 bytes you can write a program consisting of a single line with one of the keywords that accepts no arguments, then use POKE to replace it with an illegal keyword, then attempt to RUN the program.

share|improve this answer

ECMAScript, 28 25 bytes

console.log((

//Begin  
_=>atob`RUNNQVNjUmlwdA==`
//End

)())

Or, if you prefer to use the unofficial name instead:

JavaScript, 30 28 bytes

console.log((

//Begin  
_=>atob`\x53mF2YVNjUmlwdA==`
//End

)())

Edit: shaved 3 bytes off both solutions by not worrying about the casing of the output.

share|improve this answer
2  
Your code is invalid, it contains t & a – TrojanByAccident 5 hours ago

CSS, 25 bytes

:after{content:'\43\53\53

Note that extra markup is added to Stack Overflow snippets, causing "CSS" to be displayed more than once. Open an .html file with contents

<style>:after{content:'\43\53\53

to see the result as intended.

share|improve this answer

C#, 60 bytes

class P{static void Main(){\u0043onsole.Write("\x43\x23");}}
share|improve this answer

tcl, 8

puts TCL

I wrote TCL in uppercase only because puts has a lower case t.

share|improve this answer
1  
Does that not make this invalid? – darrylyeo 2 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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