Update docs

This commit is contained in:
Shunsuke Shibayama 2022-09-14 02:21:21 +09:00
parent 00c05ab668
commit 6fd9ce2650
2 changed files with 12 additions and 14 deletions

View file

@ -34,13 +34,7 @@ f some_long_name_variable_1 + some_long_name_variable_2:
some_long_name_variable_3 * some_long_name_variable_4
```
```python
f:
some_long_name_variable_1 + some_long_name_variable_2
some_long_name_variable_3 * some_long_name_variable_4
```
上の3つのコードはすべて同じ意味です。このスタイルは`if`関数などを使用するときにも便利です。
上の2つのコードは同じ意味です。このスタイルは`if`関数などを使用するときにも便利です。
```python
result = if Bool.sample!():
@ -52,7 +46,15 @@ result = if Bool.sample!():
0
```
`:`の後はコメント以外のコードを書いてはならず、必ず改行しなくてはなりません。
この場合、`:`の後はコメント以外のコードを書いてはならず、必ず改行しなくてはなりません。
また、関数の直後に`:`を使うことはできません。これができるのは`do``do!`のみです。
```python
# NG
f:
x
y
```
## キーワード引数(Keyword Arguments)

View file

@ -4,15 +4,11 @@ s = if cond:
do "else block"
assert s == "then block"
# else: binary operator
x = cond.then 1 else 2
assert x == 1
if! cond:
do!:
print! "then block"
print! "then block!"
do!:
print! "else block"
print! "else block!"
a = [1, 2, 3]
sum = match a: