Rename the "println" function to "print_line" and fix HelloWorld.ybcon
This commit is contained in:
parent
099b4e4136
commit
b8396d9059
|
@ -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.
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
main #= [] -> {
|
||||
println "Hello, World!"
|
||||
print_line("Hello, World!")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue