Rename the "println" function to "print_line" and fix HelloWorld.ybcon

This commit is contained in:
Username404 2021-12-22 20:53:35 +01:00
parent 5580b8f204
commit c25748cf87
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
2 changed files with 5 additions and 5 deletions

View File

@ -34,14 +34,14 @@ as_main helloWorld >> {}
Parameters can be added to an anonymous function by specifying the types as follows:
```
addIntToString (int, String) => { a, b;
println(b + a)
print_line(b + a)
}
```
Named functions can have parameters **(with mandatory names)** like in this example:
```
addIntToString(a: Int, b: String) => {
println(b + a)
print_line(b + a)
}
```
@ -53,14 +53,14 @@ helloWorld()
If a function does have parameters, you can call it with arguments in the right order; if the function is not anonymous, it's also possible to call it by using the names of the corresponding parameters:
```
addNumbers(int a, int b, int c, int d) >> {
println(a + b + c + d)
print_line(a + b + c + d)
}
addNumbers(1, 2, 3, 4) # Call without names
addNumbers(a = 1, b = 2, c = 3, d = 4) # Call with names
addNumbers(1, c = 3, b = 2, d = 4)
```
Note that print and println are the functions that will get transpiled to their equivalents.
Note that print and print_line are the only functions that will get transpiled to their equivalents.
## 3 - Types
Types are *inferred*, which means that specifying types of variables or returned values is optional.

View File

@ -1,3 +1,3 @@
main #= [] -> {
println "Hello, World!"
print_line("Hello, World!")
}