Code Syntax (and punctuation) in Chinese

Being a software engineer doesn’t mean I just write code. I also talk with co-workers about how we write code. Regardless of the language spoken, we need a common vocabulary to talk about code syntax and punctuation marks. Since code syntax is not something that came up in my Chinese classes, I have had to learn from my coworkers, friends and Baidu how to pronounce all these symbols. This post is a quick note to myself when, 6 months from now, I forget what these code symbols are called. I hope it’s helpful, and if you feel I’ve left something out, please leave a comment below.

# the “hash” symbol / 井 jing3

Chinese uses a similar looking character to describe the hash symbol, also known as pound.

@ the “at” symbol / 艾特 ai4te4

The “at” symbol, like in English, can be used as a verb.

There’s a bug “at”-(mentioning) people. / 艾特出bug了

. the ”dot“ symbol / 点 (儿) dian3er

The period or dot is translated directly into Chinese. Check / 查一下apple点儿com吧

, the “comma” / 逗号 dou4hao4

Describes both the Chinese comma (,) and the ASCII comma (,)

/ the “(forward) slash” / 杠 gang4

杠 is short for 斜杠.

\ the “backslash” / 反斜杠 fan3xie2gang4

Literally, a reverse slash or backwards slash.

: the “colon” / 冒号 mao4hao4

I personally find this word fun to pronounce.

; the “semicolon” / 分号 fen1hao4

There’s nothing “semi-” about the semicolon in Chinese. The Chinese term literally means the separator punctuation mark. I find the name quite fitting for describing semicolons in JavaScript, since semicolons aren’t required and are used only to separate code statements.

= the “equals” sign / 等号

The symbol comes right from math. A = B or A等于B

&& “and” / 且 qie3

In English, the ampersands are read as “and.” Chinese people will definitely understand you if you use “an4de3” but the proper pronunciation is 且 as in 而且, A且B

|| “or" / 或 huo4

In English, the pipes are read as “or.” Chinese people will definitely understand you if you use “ou1er3” but the proper pronunciation is 或 as in 或者, A或B

括号 or brackets (and parentheses) come in three sizes in Chinese: small, medium and large.

{ } curly braces / 大括号 da4kuo4hao4

The big brackets refer to curly braces.

[ ] square brackets / 中括号 zhong1kuo4hao4

The medium brackets refer to square brackets, commonly used for arrays. The Chinese term comes from mathematics where in complex formulas with nested parentheses, the outer parentheses can turn into square brackets.

( ) parentheses / 小括号 xiao3kuo4hao4

Parentheses are the smallest of the brackets. Depending on context, you can also refer to parentheses as 括号.

The dashes and underscores can also be grouped together

- the “hyphen” / 中划线 zhong1hua2xian4

Note: 划 is second tone here. The dash or hyphen is translated as the middle or center line. As far as I can tell, the term does not distinguish between the hyphen (-), the en dash (–) or the em dash (—). If anyone knows how the dashes are distinguished, please post a comment below and let me know.

_ the “underscore” / 下划线 xia4hua2xian4

划 is also second tone here. Even though we sometimes use “lodash” in English to mean underscore, 底线 means something completely different. Tip: 下划线 also means ~to underline~.

Any important symbols that I left out? Let me know below.