Quantcast
Channel: i.justrealized » syntax
Viewing all articles
Browse latest Browse all 5

It’d be pretty funny to code in Chinese

$
0
0

Saw this at cactusbeetroot’s blog:

x = 0;
油 = 0;

如果 (x 是真的)
{
油++;
x = 假;
}

You can see that the code is trying to 加油. Haha! But there really exist Chinese programming languages.

There is Chinese BASIC:

卜=0 ‘Y=0
入 水, 火 ‘INPUT E, F
從 日 = 水 到 火 ‘FOR A = E TO F
卜 = 卜+對數(日) ‘Y = Y + LOG (A)
下一 日 ‘NEXT A
印 卜 ‘PRINT Y

And let’s not forget 中蟒, ChinesePython. Which have the whole Python syntax in Chinese language. They have syntax like:

  • 写 ..(print)
  • 删除 ..(del)
  • 定义/函数 (def)
  • 忽略 (pass)
  • 中断 (break)
  • 下一个 (continue)
  • 传回 (return)
  • 示警 (raise)
  • 载入 … 名 … (import … as …)
  • 从 … 载入 …
  • 共用 (global)
  • 执行 (exec)
  • 断言 (assert)
  • 如 .. 不然 .. 否则 .. (if .. elif .. else ..)
  • 只要 .. 否则 .. (while .. else ..)
  • 取 .. 自 .. 然后 .. (for .. in .. else ..)
  • 试 .. 失败 .. 否则 .. 然后 .. (try .. except .. else .. finally .. )
  • 概念/类别 (class)
  • 来自/不来自 (in / not in)
  • 是/不是 (is / is not)
  • 或 or
  • 且 and
  • 不是 not

Pretty comprehensive I say! Well if you’re bored, you can read more about non-English programming languages. Lots of them are probably more of a joke. Some are esoteric too!


Viewing all articles
Browse latest Browse all 5

Trending Articles