Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Showcase of Languages

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>

Answer*

Draft saved
Draft discarded
Cancel
7
  • \$\begingroup\$ Actually, ] is not purely decorative. [ will refuse to function if its last argument isn't ]. \$\endgroup\$ Commented Jan 26, 2015 at 21:36
  • \$\begingroup\$ Yes, but it serves no purpose other than cosmetics; and if you substitute [ with its other form test, then the ] can be omitted without changing anything else in the call - I'm simply making the point that it's not actual bash syntax, just visual sugar. \$\endgroup\$ Commented Jan 26, 2015 at 21:39
  • \$\begingroup\$ You're right in that it's not bash syntax, but the trailing ] is [ syntax and you have to provide it just like how you have to terminate a statement in C with a semicolon. \$\endgroup\$ Commented Jan 26, 2015 at 21:40
  • 2
    \$\begingroup\$ Regarding the function x(){ syntax: You can drop the parens, as you say, but you can also just drop the function part. In fact, that's how POSIX shell defines functions, so it's more portable that way. You could define a full function in 13 characters. For example: x(){ startx;} \$\endgroup\$ Commented Jan 29, 2015 at 2:02
  • 1
    \$\begingroup\$ If you run alias [=test then while [ 1 = 1 works, [ 1 = 1 ] will complain bash: test: too many arguments. I don't suggest breaking things that might load later, which means you'd want something like test2(){ local x=;for i in "$@";do test -z "$x"&&x=1&&set --;test "$i" != \]&&set -- "$@" "$i";done;test "$@";};alias [=test2 — though this seems pedantic and against the spirit of the language. I do not recommend it. \$\endgroup\$ Commented Oct 6, 2021 at 17:50

AltStyle によって変換されたページ (->オリジナル) /