除了 BASIC 之外,还有其他语言中的 EOL == EOS 吗?
BASIC 及其变体 Visual Basic 和 VB.NET 是我所知道的唯一将行尾字符视为语句终止符的编程语言(我将批处理文件和命令脚本排除在编程语言领域之外)。我很好奇:是否有其他语言使用此约定,或者 BASIC 是独立的吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这是语言及其语句终止符的详细分析。根据该页面,这些语言以换行符结尾:
Here's a good breakdown of languages and their statement terminators. According to that page, these languages are newline terminated:
还有几个没有提到的:
Tcl。尽管它支持分号作为语句分隔符,但标准/首选约定是编写不使用分号的代码。
Forth
Haskell
APL
更新:啊..忘了。几乎所有 shell“语言”都会这样做:
sh/bash
csh/tcsh
ksh
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
我突然想到:
Off the top of my head:
大多数情况下都是 JavaScript。 Javascript 隐含了符号。
大多数只是为了好玩的语言:
Brainfuck、LOLcode、空格(不确定这个)等等
大会也正如有人已经指出的那样。
大多数现代语言并不将 EOL 视为 EOS。
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.