Skip to content

Instantly share code, notes, and snippets.

@Yi-Tseng
Created September 4, 2012 15:40
Show Gist options
  • Save Yi-Tseng/3622551 to your computer and use it in GitHub Desktop.
Save Yi-Tseng/3622551 to your computer and use it in GitHub Desktop.
if/else 範例
// 可以只寫單一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