Created
September 4, 2012 15:40
-
-
Save Yi-Tseng/3622551 to your computer and use it in GitHub Desktop.
if/else 範例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 可以只寫單一if | |
if(條件){ | |
運算式 | |
} | |
// 也可以省略大括號,但是只會執行一行 | |
if(條件) | |
運算式; | |
// 也可以寫if / else | |
if(條件){ | |
}else{ | |
} | |
// 這邊補充elseif,他可以無限加 | |
if(條件1){ | |
}else if(條件2){ | |
}else if(條件3){ | |
}else{ | |
} | |
//相同的,每一個都可以省略大括號,只是也只會執行一行 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment