Add print() as alias for say()
This commit is contained in:
parent
899e2cd3f1
commit
2c4324670f
@ -90,6 +90,27 @@ exit(status=1, "Goodbye forever!")
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### `print`
|
||||||
|
Prints a message to the console (alias for [`say`](#say)).
|
||||||
|
|
||||||
|
```tomo
|
||||||
|
func print(text:Text, newline:Bool = yes -> Void)
|
||||||
|
```
|
||||||
|
|
||||||
|
- `text`: The text to print.
|
||||||
|
- `newline`: Whether or not to print a newline after the text.
|
||||||
|
|
||||||
|
**Returns:**
|
||||||
|
Nothing.
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
```tomo
|
||||||
|
print("Hello ", newline=no)
|
||||||
|
print("world!")
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
### `say`
|
### `say`
|
||||||
Prints a message to the console.
|
Prints a message to the console.
|
||||||
|
|
||||||
|
@ -36,6 +36,10 @@ env_t *new_compilation_unit(CORD libname)
|
|||||||
FunctionType, .args=new(arg_t, .name="text", .type=TEXT_TYPE,
|
FunctionType, .args=new(arg_t, .name="text", .type=TEXT_TYPE,
|
||||||
.next=new(arg_t, .name="newline", .type=Type(BoolType), .default_val=FakeAST(Bool, true))),
|
.next=new(arg_t, .name="newline", .type=Type(BoolType), .default_val=FakeAST(Bool, true))),
|
||||||
.ret=Type(VoidType))}},
|
.ret=Type(VoidType))}},
|
||||||
|
{"print", {.code="say", .type=Type(
|
||||||
|
FunctionType, .args=new(arg_t, .name="text", .type=TEXT_TYPE,
|
||||||
|
.next=new(arg_t, .name="newline", .type=Type(BoolType), .default_val=FakeAST(Bool, true))),
|
||||||
|
.ret=Type(VoidType))}},
|
||||||
{"ask", {.code="ask", .type=Type(
|
{"ask", {.code="ask", .type=Type(
|
||||||
FunctionType, .args=new(arg_t, .name="prompt", .type=TEXT_TYPE,
|
FunctionType, .args=new(arg_t, .name="prompt", .type=TEXT_TYPE,
|
||||||
.next=new(arg_t, .name="bold", .type=Type(BoolType),
|
.next=new(arg_t, .name="bold", .type=Type(BoolType),
|
||||||
|
Loading…
Reference in New Issue
Block a user