# Which other programming languages apart from Python and predecessor are out there using indentation to define code blocks? [closed]

Python quite famously uses indentation to syntactically define blocks of code. (See Compound statements in the Python Language Reference). After years of using Python I'm still intrigued by and very fond of this syntax feature.

But I wonder: Apart from Python and its "predecessor"(*) language ABC which other programming languages are out there using indentation for definition of code blocks? Code blocks means here "multiple statements which in some way are treated as one component".

I'm particularly interested in practical programming languages, but esoteric languages might be worth mentioning as well.

(*): "Predecessor" is my choice of word in default of knowing here a better one. Guido van Rossum, the creator of Python, described the relationship between Python and ABC regarding indentation in an interview like this: "The choice of indentation for grouping was not a novel concept in Python; I inherited this from ABC."

• I don't think "please give me a list of programming languages with feature X" is a computer science question. – David Richerby May 9 '19 at 20:07
• Why, there's the Whitespace language itself that requires proper indentation for it's core method of expression. – penguin359 May 9 '19 at 23:49
• Long-form YAML is probably worth mentioning even though it's not a programming language in the strictest sense, as it's probably one of the next most likely languages with this feature for someone to encounter after Python. – Austin Hemmelgarn May 10 '19 at 0:51
• @penguin359 I also thought of Whitespace. It's not an answer to the question because indentation is, afaict, not used to define blocks; but it's certainly the language in which white space is most significant overall. – Peter - Reinstate Monica May 10 '19 at 9:34
• @DavidRicherby Grouping by attribute (i.e. categorization) is definitely a part of science: E.g. an interesting question for a Biology StackExchange could be: "What other animals walk on two legs?" Therefore I consider the above question very appropriate for the Computer Science StackExchange. – halloleo May 10 '19 at 16:54

Wikipedia has an extensive list of languages that use the off-side rule1:

• ABC
• Boo
• BuddyScript
• Cobra
• CoffeeScript
• Converge
• Curry
• Elixir (, do: blocks)
• Elm
• F# (if #light "off" is not specified)
• Genie
• Haskell (only for where, let, do, or case ... of clauses when braces are omitted)
• Inform 7
• ISWIM, the abstract language that introduced the rule
• LiveScript
• Miranda
• Nemerle
• Nim
• occam
• PROMAL
• Python
• Scheme, when using e.g. SRFI 119
• Spin
• XL

1: I've never heard this term before myself.

• The off-side rule is an exciting find! – halloleo May 10 '19 at 2:42
• Don't know if it is a language as you or wikipedia understands it, but Makefiles use indentation too. – TheWildHealer May 10 '19 at 7:22
• @TheWildHealer The wikipedia article also has a section with non-programming languages (including stuff like Make, YAML, RST). I didn't quote that because OP asked about programming languages. – Bergi May 10 '19 at 10:27
• You are right, next time I'll be sure to open my eyes, thanks. – TheWildHealer May 10 '19 at 10:31

There are: Elm, Haskell, its predecessor Miranda and its predecessor ISWIM, YAML where spaces are crucial for syntax and tabs are forbidden, OCCAM, Coffee script and Cokescript both are language to language compilers with JavaScript as target and esoteric Whitespaces.

There is also Agda - interactive theorem prover, which is probably not what you had in mind, but its lexer is very sensitive to white-space.
Makefile, which gathers targets with tab-based intends.

• Also Miranda, the language Haskell was based on. – kne May 9 '19 at 16:59
• Agda has a very Haskell-like syntax, and is sensitive to both indentation and spaces: (x-y) is not (x - y)) even if it might not be "practical" enough for the OP. – chi May 9 '19 at 18:30
• Also, CoffeeScript and the hardly-known CokeScript – Bergi May 9 '19 at 19:22
• If YAML counts, then I suppose Makefiles must as well – Izkata May 9 '19 at 19:48
• There is also PureScript. – duplode May 9 '19 at 21:35

Make fits your description, even though it probably isn't quite what you have in mind, with its limited syntax and power.

It infamously indicates its code blocks (recipes) with a particular form of whitespace: one tab character. Alternative ways are available (e.g. GNU Make supports using an alternative character), but rarely used in practice.

Another example hovering at the edge is Ansible playbooks. They are specified in YAML, which is heavily indentation dependent. YAML is not a programming language, but Ansible playbooks can be regarded as domain-specific programs.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.31414496898651123, "perplexity": 4704.006005617082}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-04/segments/1610703581888.64/warc/CC-MAIN-20210125123120-20210125153120-00201.warc.gz"}