551
\$\begingroup\$

Notes

  • This thread is open and unlocked only because the community decided to make an exception. Please do not use this question as evidence that you can ask similar questions here. Please do not create additional questions.

  • This is no longer a , nor are snippet lengths limited by the vote tally. If you know this thread from before, please make sure you familiarize yourself with the changes.

This thread is dedicated to showing off interesting, useful, obscure, and/or unique features your favorite programming languages have to offer. This is neither a challenge nor a competition, but a collaboration effort to showcase as many programming languages as possible as well as possible.

How this works

  • All answers should include the name of the programming language at the top of the post, prefixed by a #.

  • Answers may contain one (and only one) factoid, i.e., a couple of sentences without code that describe the language.

  • Aside from the factoid, answers should consist of snippets of code, which can (but don't have to be) programs or functions.

  • The snippets do not need to be related. In fact, snippets that are too related may be redundant.

  • Since this is not a contest, all programming languages are welcome, whenever they were created.

  • Answers that contain more than a handful of code snippets should use a Stack Snippet to collapse everything except the factoid and one of the snippets.

  • Whenever possible, there should be only one answer per programming language. This is a community wiki, so feel free to add snippets to any answer, even if you haven't created it yourself. There is a Stack Snippet for compressing posts, which should mitigate the effect of the 30,000 character limit.

Answers that predate these guidelines should be edited. Please help updating them as needed.

Current answers, sorted alphabetically by language name

$.ajax({type:"GET",url:"https://api.stackexchange.com/2.2/questions/44680/answers?site=codegolf&filter=withbody",success:function(data){for(var i=0;i<data.items.length;i++){var temp=document.createElement('p');temp.innerHTML = data.items[i].body.split("\n")[0];$('#list').append('<li><a href="/a/' + data.items[i].answer_id + '">' + temp.innerText || temp.textContent + '</a>');}}})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><base href="http://codegolf.stackexchange.com"><ul id="list"></ul>

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Why preserve a tag for one question, is it still bad for SE to have untagged question? \$\endgroup\$
    – l4m2
    Jan 4, 2023 at 1:43

241 Answers 241

1
5 6 7 8
9
0
\$\begingroup\$

Brainfuck

Brainfuck is an esoteric programming language created in 1993 by Urban Müller. The language consists of eight commands.

Looks like there's no BF answer. Not sure why.


Length 1 Snippet

+

+ and - are most basic instructions to modify tape. On Modulo-256 version, - equals to 255 +.

Length 2 Snippet

>>

Instead of cleaning up current memory, it's usually shorter to just go to a clean position

Length 3 Snippet

+[]

An infinite loop.

Length 4 Snippet

[->]

Decrease elements from here by one, until meeting 0.

It's useful to have unbalanced pointer moving in a loop, although that'd make it harder to understand.

Length 5 Snippet

,[.,]

Cat. Usually first shown as it's more simple than hello world.

Moved from Length 2 since Length 5 is empty.

Length 6 Snippet

[->+<]

Add current value to the next value.

There's no move or add in brainfuck. The only way to move value is by a loop, each time reduce source by one and increase destination.

\$\endgroup\$
1
5 6 7 8
9

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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