or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
條件判斷
2021/09/24 電算社第二堂社課
複習基本的程式架構
複習上次學過的條件運算
條件運算
算完的結果會是一個布林值
不是True就是False
邏輯運算
多條件的條件運算

得到的結果也是一個布林值
Examples
條件判斷
if
else
有 else 就一定會有 if,
所以在打Code的時候記得要注意喔
else if
巢狀if : if裡面再包if
三元預算子(Question mark operator)
基本結構
回傳值類型會依據b和c的類型改變,
盡量不要使用不同的類型
什麼時候會用到?
在只有單行if - else的時候
比起那樣寫,你也可以選擇這個:
小練習
電算社想要針對每個社員的表現進行評分,
在經過了兩次考試之後,
決定讓總和90分以上的得A,
總和80分以上得B,
總和70分以上得C,
總和60分以上得D,
總和59分以下得F。
輸入說明:輸入兩個整數m,n。(0<=m,n<=50)
輸出說明:輸出等第。
範例輸入:42 45
範例輸出:B
我是防雷頁:D
解答
練習題
閏年判斷-巢狀判斷
閏年判斷-條件判斷