Semicolons

Semicolons are expression delimiters and they are inferred. Scala treats the end of a line as the end of an expression, except when it can infer that the expression continues to the next line, as in this example:

// src/main/scala/progscala2/typelessdomore/semicolon-example.sc

// Trailing equals sign indicates more code on the next line.
def equalsign(s: String) =
    println("equalsign: " + s)

// Trailing opening curly brace indicates more code on the next line.
def equalsign2(s: String) = {
    println("equalsign2: " + s)
}

// Trailing commas, periods, and operators indicate more code on the next line.
def commas(s1: String,
    s2: String) = Console.
    println("comma: " + s1 +
    ", " + s2)


Ref

《Programming Scala》

{ "Lingma.PreferredLanguage for AI Chat": "系统默认", "workbench.colorTheme": "Visual Studio Dark", "files.autoSave": "afterDelay", "code-runner.executorMap": { "python": "set PYTHONIOENCODING=utf8 && $pythonPath -u $fullFileName" }, "code-runner.runInTerminal": true, "python.languageServer": "Pylance", "python.analysis.typeCheckingMode": "basic", "editor.formatOnSave": true, "editor.tabSize": 4, "editor.insertSpaces": true, "files.encoding": "utf8", "editor.autoClosingBrackets": "beforeWhitespace", "editor.autoClosingDelete": "always", "editor.autoClosingOvertype": "always", "editor.autoClosingQuotes": "beforeWhitespace", "editor.wordSeparators": "`~!@%^&*()=+[{]}\\|;:'\",.<>/?(),。;:", "editor.mouseWheelZoom": true, "editor.stickyScroll.enabled": true, "explorer.compactFolders": true, "notebook.compactView": true, "editor.wordWrap": "on", "editor.lineHeight": 1.6, "editor.detectIndentation": false, "files.trimTrailingWhitespace": true, "javascript.format.semicolons": "remove", "typescript.format.semicolons": "remove", "typescript.preferences.preferTypeOnlyAutoImports": true, "typescript.preferences.includePackageJsonAutoImports": "on", "javascript.suggest.autoImports": true, "typescript.suggest.autoImports": true, "vue.updateImportsOnFileMove.enabled": true, "workbench.editor.customLabels.patterns": { "**/index.vue": "${dirname}.vue", "**/index.js": "${dirname}.js", "**/index.ts": "${dirname}.ts", "**/index.jsx": "${dirname}.jsx", "**/index.tsx": "${dirname}.tsx" }, "files.associations": { "*.wxss": "css", "*.wxml": "html", "*.svg": "html", "*.xml": "html", "*.wxs": "javascript", "*.cjson": "jsonc", "*.json": "jsonc", }, "editor.suggest.snippetsPreventQuickSuggestions": false, "editor.acceptSuggestionOnEnter": "smart", "editor.suggestSelection": "recentlyUsedByPrefix", "editor.suggest.insertMode": "replace", "editor.quickSuggestions": { "other": true, "comments": true, "strings": true }, "search.exclude": { "**/node_modules": true, "**/pnpm-lock.yaml": true, "**/package-lock.json": true, "**/.DS_Store": true, "**/.git": true, "**/.gitignore": true, "**/.idea": true, "**/.vscode": true, "**/build": true, "**/dist": true, "**/tmp": true, }, "editor.wordWrapColumn": 200, "[html]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[css]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[less]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[scss]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[vue]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[json]": { "editor.defaultFormatter": "vscode.json-language-features" }, "[jsonc]": { "editor.defaultFormatter": "vscode.json-language-features" }, "[yaml]": { "editor.defaultFormatter": "redhat.vscode-yaml" } }增加中文注释
最新发布
06-30
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值