除了 BASIC 之外,还有其他语言中的 EOL == EOS 吗?

发布于 2024-08-19 19:10:31 字数 124 浏览 3 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

萝莉病 2024-08-26 19:10:31

这是语言及其语句终止符的详细分析。根据该页面,这些语言以换行符结尾:

  • AutoHotkey
  • GFA BASIC
  • BASIC / Visual Basic / Visual Basic .NET
  • Fortran
  • Ruby
  • Python
  • AppleScript
  • Windows PowerShell
  • Boo
  • MATLAB (显示结果)

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)
偷得浮生 2024-08-26 19:10:31
  • FORTRAN - 如果需要多行,则有一个连续字符
  • 我知道的所有汇编语言
  • MS-DOS .BAT 脚本语言
  • FORTRAN - there's a continuation character if you need multiple lines
  • All assembly languages that I'm aware of
  • MS-DOS .BAT scripting language
风启觞 2024-08-26 19:10:31

还有几个没有提到的:

  • 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

演出会有结束 2024-08-26 19:10:31

我突然想到:

  • JavaScript 的“自动分号插入”意味着当某些规则适用时,它将换行符视为语句结束。
  • Ruby 将换行符视为语句终止符,除非它前面有一个运算符,在这种情况下,它将在下一行继续该语句。

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.
旧城烟雨 2024-08-26 19:10:31

大多数情况下都是 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文