海纳百川

海纳百川 is an Esoteric Programming Language designed by PrySigneToFry.
You're free to edit this esoteric programming language.
= Language overview =
海纳百川 is a programming language, it's Turing-complete, High-level, and very usable but esoteric. This language is also called "United Esolang".
= Restrictions on commands =
# The commands you add must be computable, that is, executable.
# The commands you add must be able to make the programming language more powerful or have more functionality, or merge many codes into a single line of code.
# You can't delete other people's commands, but you can fix their descriptions.
# The command you add must be as cross-platform as possible, unless it involves the operating system.
# You must add a note to your command, attributing its author. Commands that do not indicate the author are all commands created by PrySigneToFry.
# The commands you add must not joke, such as, "If the input is suefnaycgsepcfiuaeicbasebasebfiaubgepfcbasipexaeaiuebfgasef, then bluescreen the user".
If your command is against the rule, it will be reverted.
= Original commands overview =
== Comment ==
# I'm a one-line comment!
/**
 I am
 a multi-line
 comment!
 */
/**
 * Document comment
 * often used on
 * module/library document, 
 * just like in C++.
 */
/**
 /**
 It's illegal.
 */
 */
== Identifier ==
United Esolang uses every identifier that:
# Not started with number.
# Not include special symbols.
# Not keyword.
It is important to note that United Esolang supports all kinds of Latin, Greek, Cyrillic, even Japanese, Chinese, Korean, and all left-to-right scripts, but not historical scripts, such as Rune, Gothic, cuneiform, or right-to-left scripts such as Arabic, Hebrew, Syriac, etc.
Thus, a, _i, my_name, PRYSIGNETOFRY, number_2, 我的名字, 私の名前, are legal identifier, and while, $money, 42dk are illegal identifier.
At the same time, we stipulate that if a variable starts with two underscores and is all uppercase, then the variable is protected by United Esolang.
== Variable ==
By default, all variables are global (unless you've declared them local) and can be accessed casually, even to a non-existent variable, without compilation errors or resulting in traceback output, but with a null value - None.
Of course, if you have declared its type, its value will be the default.
Use this code to define an variable:
var (var_type) var_name (= var_value)
=== Constants ===
Constants are the variable that unchangable.
Use this code to define a constant:
constant const (const_type) const_name = const_value
==== Magic constants ====
Magic constants are the constants that changes with special condition.
# __LINE__: Changes with current line number. Always unsigned number.
# __FILE__: Changes with file name. Always string.
# __DIRECTORY__: Changes with the path. Always string.
# __TIME__: Changes with the execution time. Always float number.
=== Data types ===
Currently, we have these types: 
* Numbers, such as 3, 7, 3.14, -2, 114514, 1e20, 3.683E-34, 3.130582375184619046479671967486, etc. Initial value is 0 for int, and 0.0 for float.
* Strings, such as 'Hello' (or "Hello"). Strings can be enclosed in double quotes or single quotes, just like work in Python. Initial value is "". Use parseInt(), parseFloat() and parseLogic() to convert string to int, float or bool.
* Booleans. It can only be True, or False. Initial value is False.
* Tables. This is the most important data type in United Esolang, it can express a list or a dictionary, such as {1, 2, 3}, or {key = value}. Initial value is {}. Also, if you define a table as a list, then you use brackets instead of braces.
** List. It uses the brackets for table parentheses. initial value is []. You can use slice, as slice in Python.
** Set. It is the common type of table, and it will sort when initialized, and sort after every deletion and insertion. Initial value is {}.
** Dictionary. It is a table with key-value bind. Initial value is {}.
* Tuples. It is just a "unchangable table", such as (5, 2), (4, 8, 3, 8, 9), but (1, ) instead of (1). Initial value is (,).
* Functions. They're 1st-class citizens, which can be passed and returned as arguments.
* Empty types. They has only a value, None. They converts to 0, but they can used to be true. When they converted to string, they becomes "啊？".
* User-defined types. They're defined by "data" command.
* Undefined behaviour. This often occurs when you trying to do something incorrect, such as 5/0. They converts to 0, but they can used to be false. When they converted to string, they becomes 99 bottles of beer.
* Thread. It can fork a process out to do another program.
=== Special Assignment ===
United Esolang also can assign many values to many variables.
When encountering an assignment statement, United Esolang will evaluate all the values on the right before performing the assignment operation, so we can swap the values of the variables like this:
x = 6
y = 9
x, y = y, x
=== Index ===
United Esolang uses subscript to index. However, -1 returns the first-to-last element, -2 is the second-to-last element, -3 is the third-to-last element, and so on.
== Inputs and outputs ==
By default, United Esolang outputs content to stdout and reads content from the stdin. You can specify the input and output files, and you can restore the handle by changing the file to "CON" (supposedly the Satanic username for Windows 98), outputting content to stdout and reading content from the stdin.
Use print() for output, and input() for input.
When the specified file does not exist, input() throws an error and print() automatically creates the file.
P.S.: input() normally returns a string. You can use py2_input() to work the input() like Python 2.x version.
== Loop ==
United Esolang supports five kinds of loops.
 Loops
Loop type 	Description
for 	This is an iteration loop that executes a statement once for each iteration object in the iteration container (e.g., an element in a list, a number in a range array).
while 	It's a conditional loop that does the same thing over and over again when the condition is true. Before each execution, it checks whether the return value of the condition is true.
do ... while 	It's a conditional loop that does the same thing over and over again when the condition is true. After each execution, it checks whether the return value of the condition is true.
repeat ... until	It's a conditional loop that does the same thing over and over again when the condition is true. After each execution, it checks whether the return value of the condition is false.
forever 	It's an endless loop where it does the same thing forever until it's broken.
You can control the loop by:
 Loop control
Statement	Description
break 	It will exit the loop immediately.
continue 	It will jump to the next round of the loop.
== Conditional structure ==
United Esolang uses the conditional jump just like Python, uses if-elif-else structure.
== Functions ==
In United Esolang, functions are the primary method of abstracting statements and expressions. It can be used to handle some special work, and it can also be used to calculate some values.
United Esolang provides a number of built-in functions that you can easily call in your program, such as the print() function, which prints the parameters passed in to the console.
There are two main uses for United Esolang functions:
# Complete the specified task, in which case the function is used as a call statement;
# Evaluates and returns a value, in which case the function is used as an expression for the assignment statement.
The definition format is shown as below:
optional_function_scope function return_value_type function_name(argument1, argument2, argument3..., argumentn)
 function_body
 (return result_params_comma_separated)
end
If you want to return nothing, you can omit the function type.
== String ==
String can compare and do addition like string type in C++.
And, you can also put string in triple quote or sextuple quote, no escape needed because it becames a document string.
== Error Handling ==
United Esolang handles errors like in Python, but there is no ZeroDivisionError because it will causes an undefined behaviour.
== OOP ==
United Esolang is an Object-oriented programming language.
=== The definition of class ===
// Define a class and create an object
class Person:
 var name: string
 var age: int
 __init__(string name, int age):
 this.name = name
 this.age = age
 def greet() -> string:
 return f"Hello, my name is {this.name} and I am {this.age} years old."
var person = Person("Alice", 30) // "Spawn" a person
print(person.greet()) // Output: Hello, my name is Alice and I am 30 years old.
==== Inheritance and polymorphism ====
Let's say we've defined the person class.
class Employee: Person:
 var employeeId: string
 
 __init__(string name, int age, string employeeId):
 super(name, age)
 this.employeeId = employeeId
 
 override def greet() -> string:
 return super.greet() + " My employee ID is " + this.employeeId + "."
 // Adding two strings is equivalent to joining the following string to the tail of the previous string.
 
var employee = Employee("Bob", 40, "E12345")
print(employee.greet()) // Output: Hello, my name is Bob and I am 40 years old. My employee ID is E12345.
== Garbage collection ==
United Esolang will automatically collect garbages(dead objects, such as a variable that no longer to use).
= Added Command List =
Add your command here.
= Examples =
Add your examples here.
= Categories and References =
Category:User Edited Category:Languages Category:Turing complete Category:2025 Category:High-level