是否有任何语言名称可以包含空格字符? [英] Is there any language where names can include space characters?

查看:50
本文介绍了是否有任何语言名称可以包含空格字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何编程语言允许名称包含空格?(按名称,我指的是变量、方法、字段等)

Is there any programming language that allows Names to include white spaces ? (By names, I intend variables, methods, field, etc.)

推荐答案

Scala 确实允许在标识符名称中使用空格字符(但要做到这一点,您需要用一对反引号将标识符括起来).

Scala does allow whitespace characters in identifier names (but for that to be possible, you need to surround the identifiers with pair of backticks).

示例(在 Scala REPL 中执行):

Example (executed at Scala REPL):

Welcome to Scala version 2.8.0.final (Java HotSpot(TM) Client VM, Java 1.6.0_22).
Type in expressions to have them evaluated.
Type :help for more information.

scala> val `lol! this works! :-D` = 4
lol! this works! :-D: Int = 4

scala> val `omg!!!` = 4
omg!!!: Int = 4

scala> `omg!!!` + `lol! this works! :-D`
res0: Int = 8

这篇关于是否有任何语言名称可以包含空格字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆