Skip to content

Commit

Permalink
feat(docs): update docs (#583)
Browse files Browse the repository at this point in the history
feat(docs): update docs

Updates the Wing docs. See details in [workflow run].

[Workflow Run]: https://github.com/winglang/docsite/actions/runs/6018610819

------

*Automatically created via the "update-docs" workflow*
  • Loading branch information
monadabot authored Aug 29, 2023
1 parent bd592a9 commit dfbd984
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions versioned_docs/version-latest/03-language-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,12 +516,10 @@ log("UTC: ${t1.utc.toIso())}"); // output: 2023-02-09T06:21:03.000Z
| Name | Extra information |
| -------- | -------------------------------------------------------- |
| `log` | logs str |
| `throw` | creates and throws an instance of an exception |
| `assert` | checks a condition and _throws_ if evaluated to false |
> ```TS
> log("Hello ${name}");
> throw("a recoverable error occurred");
> assert(x > 0);
> ```
Expand Down Expand Up @@ -1173,7 +1171,7 @@ The loop invariant in for loops is implicitly re-assignable (`var`).
### 2.7 while
**while** statement is used to execute a block of code while a condition is true.
The **while** statement evaluates a condition, and if it is true, a set of statements is repeated until the condition is false.
> ```TS
> // Wing program:
Expand All @@ -1186,6 +1184,20 @@ The loop invariant in for loops is implicitly re-assignable (`var`).
---
### 2.8 throw
The **throw** statement raises a user-defined exception, which must be a string expression.
Execution of the current function will stop (the statements after throw won't be executed), and control will be passed to the first catch block in the call stack.
If no catch block exists among caller functions, the program will terminate.
(An uncaught exception in preflight causes a compilation error, while an uncaught exception in inflight causes a runtime error.)
> ```TS
> // Wing program:
> throw "Username must be at least 3 characters long.";
> ```
[`top`][top]
## 3. Declarations
### 3.1 Structs
Expand Down

1 comment on commit dfbd984

@vercel
Copy link

@vercel vercel bot commented on dfbd984 Aug 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.