元旦

元旦(yuandan) is an programming language that designed by PSTF and None1.
== Basic command ==
The basic commands are designed by PSTF.
I'll made it into Chinese uyjhmn n, but looks not so terrible.
Comment: # or /**/.
 The basic command table
Command 	What does it do?
声明一个名为[a]的变量（并将其设置为[b]类型）/（并将其赋值为[c]） 	Declare a variable named a and set it to a b type or give a value of c. All variables, if you don't specify a type, then it must be a blank type. If two variables have the same name, the later created variables will never be able to operate. All operations can only be used in the first variable with the same name. However, if you delete this variable with the same name, the corresponding inaccessible variable will also disappear.
将[a]赋值为[b] 	Assign b to a.
[a]加/减/乘/除以/模数/整除/左移位/右移位/或/且/按位与/按位或/按位异或/等于/不等于/大于/小于/大于或等于/小于或等于[b] 	The binocular infix operations.
[a]的\与[b] 次方/为底数的对数/次方根\的 最大公因数/最小公倍数 	The binocular suffix operations.
非/取反/负[a] 	The monocular prefix operations.
[a]的 正弦/余弦/正切/余切/正割/余割 	The monocular suffix operations.
如果[exp1]那么{code1}（否则如果[exp2]那么{code2}……否则{coden+1}） 	An if-statement.
只要[exp]就一直做{code} 	A while-statement.
对于每个在迭代容器[iterators]中的迭代对象[iterator]都执行{code} 	A for-statement.
重复执行[x]次{code} 	A repeat-statement in Logo.
重复执行{code}直到[expr] 	A repeat-until statement in Haskell.
输出（以[y]作为结尾的）[x] 	Outputs the value of x, followed by the value of y. If y is left blank, a line break is output by default.
（以[y]为提示符）输入[x]的值 	Enter a value for x with y as a hint. It returns a string by default, but it will be parsed into a different type. If y is left blank, then it will prompt nothing.
以[x]作为格式输入[a1]、[a2]、…… 	Just like the scanf() function in C. %d is integer, %f is float number, %s is a string ended by space, %x uses hexadecimal, %o uses octal, %b uses binary.
结束程序 	Self-explanatory.
=== Type conversion ===
 	整数 	小数 	布尔值 	字符串 	列表 	空白 	未定义
整数 	 	floor(x) 	x ? 1 : 0 	parseInt(x) or 0 	length(x) 	0 	0
小数 	x/1 	 	x ? 1.0 : 0.0 	parseFloat(x) or 0.0	length(x) / 1 	0.0 	0.0
布尔值 	x != 0 	x != 0.0 	 	x != "" 	x != [] 	真 	假
字符串 	toString(x)	toString(x)	x ? "真" : "假" 	 	"[" + ", ".join(x) + "]"	"" 	99 bottles of beer
列表 	[x] 	[x] 	[x] 	[x] 	 	[] 	[未定义]
=== Type definition ===
 Definition
Type 	Define it
整数 	Use decimal, and use the regular digits.
小数 	Just like integer.
布尔值 	真/假
字符串 	A string quoted by double quote. all escaping characters will work like in Python.
未定义 	Any undefined behaviour.
空白 	Blank variable.
==Update 1==
These commands are designed by None1.
 Update 1
Command 	What does it do?
令[a]为随机数 	Random decimal number within [0,1).
令[a]为[b]到[c]的随机数 	Random integer within [b,c]
一直做{code} 	Infinite loop
无操作 	NOP
跳出循环 	Break a loop
跳过循环 	Skip this turn of the loop (like Python's continue)
定义函数“[f]”执行{code} 	Define function f without arguments
执行函数“[f]” 	Call function f
脑操[a] 	Treat [a] (convert it to string first) as a brainfuck program and execute it
==Update 2==
These commands are designed by PSTF.
 Update 2
Command 	What does it do?
定义函数“[f]”参数列表为[*args, **kwargs]执行{code} 	Define function f with arguments.
返回[x] 	Returns x. If it is in the main program then exit with error code x.
定义标签[x]{code} 	Define a label x.
跳转至标签[x] 	Go to label x.
停止程序 	Halt the program.
== Update 3 ==
 Update 3
Command 	What does it do?
打开文件[x] 	Open the file x. If x has not found in the workspace(or specified directory), then output "该文件不存在！".
关闭文件[x] 	Close the file x.
死鱼[x] 	Treat [x] (convert it to string first) as a Deadfish program and execute it
（以[lang]）运行[x] 	Execute x with language lang. If lang is not specified, then normally execute x in 元旦.
引入[lib]库 	Imports lib library. Currently, 元旦 supports these libraries: 海龟绘图, 操作系统, 时间, 算法库, Kitten4接口, 互联网操作.
== Example ==
=== Hello, world! ===
 输出"問天地好在。"
=== Truth Machine ===
声明一个名为truth的变量并将其设置为布尔值类型
以"%d"作为格式输入truth
如果truth等于假那么
{
 输出"0"
 停止程序
}
否则
{
 一直做
 {
 输出"1"
 }
}
=== Usage of Internet operation ===
引入互联网操作库
连接至互联网
声明一个名为speed的变量并将其赋值为（通过www.example.com测试网络速度）
输出speed
断开与互联网的连接
And horribly translated version(Baidu: Chinese-CN -> Persian -> Amharic -> Malaysian -> Norsk Nynorsk -> Chinese-cn)
横幅选项
互联网
通过www.Com编辑“质量”的特殊名称。
电话
获取互联网
=== 99 bottles of beer, by cheating ===
声明一个名为s的变量并将其设置为字符串类型
将s赋值为5除以0
输出s
== Categories ==
Category:Languages
Category:2025
Category:Turing complete
Category:High-level
Category:CJK