Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions docs/1-trial-session/09-functions/_samples/max-no-else/index.html

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions docs/1-trial-session/09-functions/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -189,23 +189,6 @@ function max(a, b) {

<ViewSource url={import.meta.url} path="_samples/max" />

:::note

`a > b`が`true`の場合、if文内部の`return`で関数実行が中断されるため、`else`キーワードは必ずしも必要ではありません。そのため、次のように書くこともできます。

```javascript
function max(a, b) {
if (a > b) {
return a;
}
return b;
}
```

<ViewSource url={import.meta.url} path="_samples/max-no-else" />

:::

</Answer>

## 演習問題2(発展)
Expand Down