diff options
Diffstat (limited to 'doc/yue-de.md')
| -rw-r--r-- | doc/yue-de.md | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/doc/yue-de.md b/doc/yue-de.md index 9149231..1a13a47 100644 --- a/doc/yue-de.md +++ b/doc/yue-de.md | |||
| @@ -2779,6 +2779,64 @@ if a in list | |||
| 2779 | 2779 | ||
| 2780 | </YueDisplay> | 2780 | </YueDisplay> |
| 2781 | 2781 | ||
| 2782 | Der `in`-Operator kann auch mit Tabellen verwendet werden und unterstützt die Variante `not in` für Verneinungen: | ||
| 2783 | |||
| 2784 | ```yuescript | ||
| 2785 | has = "foo" in {"bar", "foo"} | ||
| 2786 | |||
| 2787 | if a in {1, 2, 3} | ||
| 2788 | print "a ist in der Tabelle" | ||
| 2789 | |||
| 2790 | not_exist = item not in list | ||
| 2791 | |||
| 2792 | check = -> value not in table | ||
| 2793 | ``` | ||
| 2794 | |||
| 2795 | <YueDisplay> | ||
| 2796 | |||
| 2797 | ```yue | ||
| 2798 | has = "foo" in {"bar", "foo"} | ||
| 2799 | |||
| 2800 | if a in {1, 2, 3} | ||
| 2801 | print "a ist in der Tabelle" | ||
| 2802 | |||
| 2803 | not_exist = item not in list | ||
| 2804 | |||
| 2805 | check = -> value not in table | ||
| 2806 | ``` | ||
| 2807 | |||
| 2808 | </YueDisplay> | ||
| 2809 | |||
| 2810 | Eine Ein-Element-Liste oder Tabelle prüft auf Gleichheit mit diesem Element: | ||
| 2811 | |||
| 2812 | ```yuescript | ||
| 2813 | -- [1,] prüft, ob wert == 1 | ||
| 2814 | c = a in [1,] | ||
| 2815 | |||
| 2816 | -- {1} prüft auch, ob wert == 1 | ||
| 2817 | c = a in {1} | ||
| 2818 | |||
| 2819 | -- Ohne Komma ist [1] ein Indexzugriff (tb[1]) | ||
| 2820 | with tb | ||
| 2821 | c = a in [1] | ||
| 2822 | ``` | ||
| 2823 | |||
| 2824 | <YueDisplay> | ||
| 2825 | |||
| 2826 | ```yue | ||
| 2827 | -- [1,] prüft, ob wert == 1 | ||
| 2828 | c = a in [1,] | ||
| 2829 | |||
| 2830 | -- {1} prüft auch, ob wert == 1 | ||
| 2831 | c = a in {1} | ||
| 2832 | |||
| 2833 | -- Ohne Komma ist [1] ein Indexzugriff (tb[1]) | ||
| 2834 | with tb | ||
| 2835 | c = a in [1] | ||
| 2836 | ``` | ||
| 2837 | |||
| 2838 | </YueDisplay> | ||
| 2839 | |||
| 2782 | # For-Schleife | 2840 | # For-Schleife |
| 2783 | 2841 | ||
| 2784 | Es gibt zwei Formen der `for`-Schleife, genau wie in Lua: eine numerische und eine generische. | 2842 | Es gibt zwei Formen der `for`-Schleife, genau wie in Lua: eine numerische und eine generische. |
