Skip to content

Commit

Permalink
document the thing.
Browse files Browse the repository at this point in the history
  • Loading branch information
DEntisT committed Jan 5, 2024
1 parent 98600b9 commit 139400d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
- [Namespaces](doc/namespace.md)
- [Passing arguments to user functions](doc/userargs.md)
- [Persistent data management](doc/persistent.md)
- [`return` and `yield&return`](doc/return.md)
- [`return`](doc/return.md)
- [System values](doc/sysval.md)
- [Tasks](doc/tasks.md)
- [Function structure types](doc/struct.md)
Expand Down
4 changes: 4 additions & 0 deletions doc/decorators.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ void mytask() public
}
```

## `@yield`

Check the return documentation.

# `this` keyword

- This keyword is used for modifying decorator parameter values, without a specific order.
Expand Down
24 changes: 16 additions & 8 deletions doc/return.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,30 @@ system.rem("Thing above will print 1")
```


### `yield&return`
### `@yield` decorator

- `yield` return will do the same thing as a normal return, the difference is that the code block won't stop being executed until `};` or `return..,..;`.
- Using the `@yield` decorator before the return statement does not stop the code block from executing after returning a specific value. Example:

```cpp
int MyForm() public
str func() public
{
console.println("Hello World")
yield&return,1
console.println("This code will be executed too")
console.println("Print 1")
static*new.str,returnstr="Print 2"
@yield
return returnstr
if.notequ,1,1->return "Print OOPS"
console.println("Print 3")
}

console.cout(MyForm);
system.rem("Thing above will print 1")
console.println(func)
```

Output:
```
Print 1
Print 3
Print 2
```

## Return types

Expand Down

0 comments on commit 139400d

Please sign in to comment.