Skip to content

Commit

Permalink
docs: conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan4yin committed Jun 27, 2024
1 parent 6fe514a commit 0566e44
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/tutorials/lang/Manuals.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,14 @@ in inc 1

### 条件判断

if-then-else 表达式
Nix 的条件判断表达式的结构类似于这样:

基本结构为 `if <exprCond> then <exprThen> else <exprElse>`,此表达式在
_exprCond_ 求值为 `true` 时,结果为 _exprThen_ ,否则结果为 _exprElse_
```nix
if <exprCond> then <exprThen> else <exprElse>
```

其中 _exprCond_ 的求值结果必须为布尔值 `true``false`.
_exprCond_ 求值为 `true` 时,上述条件表达式的结果为 _exprThen_ ,否则结果为 _exprElse_.

定义时的使用例子如下:

Expand Down

0 comments on commit 0566e44

Please sign in to comment.