BASIC and its variants Visual Basic and VB.NET are the only programming languages I know of that treat the end of line character as a statement terminator (I'm excluding batch files and command scripts from the domain of programming languages). I'm curious: is there any other language that uses this convention, or does BASIC stand alone?
A:
Javascript in most cases. Javascript has implied simicolons.
Most of the just for fun languages:
Brainfuck, LOLcode, whitespace (not sure on this one), etc.
Assembly does also as someone already pointed out.
Most modern languages do not treat EOL as an EOS.
Malfist
2010-01-29 17:29:40
_"Most modern languages"_ -- not true. Python, Ruby and Haskell are all modern languages that treats end of line as statement separator. In fact, I'd say there is a trend for newer programming languages to do this.
slebetman
2010-01-29 17:59:35
I said most, not all.
Malfist
2010-01-29 19:08:05
A:
Off the top of my head:
- JavaScript's "automatic semicolon insertion" means it treats newlines as end-of-statement when certain rules apply.
- Ruby treats newlines as statement terminators, unless there's an operator in front of it in which case it continues the statement on the next line.
T.J. Crowder
2010-01-29 17:30:14
+2
A:
- FORTRAN - there's a continuation character if you need multiple lines
- All assembly languages that I'm aware of
- MS-DOS .BAT scripting language
anon
2010-01-29 17:31:26
+1
A:
Here's a good breakdown of languages and their statement terminators. According to that page, these languages are newline terminated:
- AutoHotkey
- GFA BASIC
- BASIC / Visual Basic / Visual Basic .NET
- Fortran
- Ruby
- Python
- AppleScript
- Windows PowerShell
- Boo
- MATLAB (result displayed)
Ahmad Mageed
2010-01-29 17:33:29
A:
Several more not mentioned:
Tcl. Although it supports semicolons as statement separators the standard/preferred convention is to write code without semicolons.
Forth
Haskell
APL
update: Ah.. forgot. Almost all shell "languages" do this:
sh/bash
csh/tcsh
ksh
slebetman
2010-01-29 17:57:19