Skip to content

Commit

Permalink
simplify if-expr-true-else-false with expr (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyfettes authored Sep 2, 2024
1 parent 65591cb commit 924fb8d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions moonbit-docs/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,8 @@ Almost all built-in sequential data structures have implemented `Iter`:

```moonbit
fn filter_even(l : Array[Int]) -> Array[Int] {
let l_iter: Iter[Int] = l.iter()
l_iter.filter(fn { x => if (x & 1) == 1 { true } else { false } }).collect()
let l_iter : Iter[Int] = l.iter()
l_iter.filter(fn { x => (x & 1) == 1 }).collect()
}
fn fact(n : Int) -> Int {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,8 @@ MoonBit 的内置类型 `Iter[T]` 提供了迭代器支持。基本上所有的

```moonbit
fn filter_even(l : Array[Int]) -> Array[Int] {
let l_iter: Iter[Int] = l.iter()
l_iter.filter(fn { x => if (x & 1) == 1 { true } else { false } }).collect()
let l_iter : Iter[Int] = l.iter()
l_iter.filter(fn { x => (x & 1) == 1 }).collect()
}
fn fact(n : Int) -> Int {
Expand Down

0 comments on commit 924fb8d

Please sign in to comment.