diff options
| author | Li Jin <dragon-fly@qq.com> | 2026-02-15 05:49:13 +0000 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2026-02-15 07:36:30 +0000 |
| commit | cf5b1b4a68d762e6e33cac8367611ecea15fa942 (patch) | |
| tree | 25de1a4113d26882c0135e38b7ff166efbc39969 /doc/yue-en.md | |
| parent | ecd8f3bfd07e91d04e0a2d72f4a50f9cc6c75433 (diff) | |
| download | yuescript-cf5b1b4a68d762e6e33cac8367611ecea15fa942.tar.gz yuescript-cf5b1b4a68d762e6e33cac8367611ecea15fa942.tar.bz2 yuescript-cf5b1b4a68d762e6e33cac8367611ecea15fa942.zip | |
Add goto statement documentation and tests
- Added goto.md documentation files in all languages (en, de, zh, pt-br, id-id)
- Updated conditionals.md to include goto statement references
- Updated VitePress config to include new goto documentation pages
- Updated makefile for goto documentation compilation
- Added test outputs for goto examples in all languages
- Updated yue.cpp core implementation
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'doc/yue-en.md')
| -rw-r--r-- | doc/yue-en.md | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/doc/yue-en.md b/doc/yue-en.md index a3d98d3..3f8546a 100644 --- a/doc/yue-en.md +++ b/doc/yue-en.md | |||
| @@ -2780,6 +2780,64 @@ if a in list | |||
| 2780 | 2780 | ||
| 2781 | </YueDisplay> | 2781 | </YueDisplay> |
| 2782 | 2782 | ||
| 2783 | The `in` operator can also be used with tables and supports the `not in` variant for negation: | ||
| 2784 | |||
| 2785 | ```yuescript | ||
| 2786 | has = "foo" in {"bar", "foo"} | ||
| 2787 | |||
| 2788 | if a in {1, 2, 3} | ||
| 2789 | print "a is in the table" | ||
| 2790 | |||
| 2791 | not_exist = item not in list | ||
| 2792 | |||
| 2793 | check = -> value not in table | ||
| 2794 | ``` | ||
| 2795 | |||
| 2796 | <YueDisplay> | ||
| 2797 | |||
| 2798 | ```yue | ||
| 2799 | has = "foo" in {"bar", "foo"} | ||
| 2800 | |||
| 2801 | if a in {1, 2, 3} | ||
| 2802 | print "a is in the table" | ||
| 2803 | |||
| 2804 | not_exist = item not in list | ||
| 2805 | |||
| 2806 | check = -> value not in table | ||
| 2807 | ``` | ||
| 2808 | |||
| 2809 | </YueDisplay> | ||
| 2810 | |||
| 2811 | A single-element list or table checks for equality with that element: | ||
| 2812 | |||
| 2813 | ```yuescript | ||
| 2814 | -- [1,] checks if value == 1 | ||
| 2815 | c = a in [1,] | ||
| 2816 | |||
| 2817 | -- {1} also checks if value == 1 | ||
| 2818 | c = a in {1} | ||
| 2819 | |||
| 2820 | -- Without comma, [1] is indexing (tb[1]) | ||
| 2821 | with tb | ||
| 2822 | c = a in [1] | ||
| 2823 | ``` | ||
| 2824 | |||
| 2825 | <YueDisplay> | ||
| 2826 | |||
| 2827 | ```yue | ||
| 2828 | -- [1,] checks if value == 1 | ||
| 2829 | c = a in [1,] | ||
| 2830 | |||
| 2831 | -- {1} also checks if value == 1 | ||
| 2832 | c = a in {1} | ||
| 2833 | |||
| 2834 | -- Without comma, [1] is indexing (tb[1]) | ||
| 2835 | with tb | ||
| 2836 | c = a in [1] | ||
| 2837 | ``` | ||
| 2838 | |||
| 2839 | </YueDisplay> | ||
| 2840 | |||
| 2783 | # For Loop | 2841 | # For Loop |
| 2784 | 2842 | ||
| 2785 | There are two for loop forms, just like in Lua. A numeric one and a generic one: | 2843 | There are two for loop forms, just like in Lua. A numeric one and a generic one: |
