40 lines
		
	
	
		
			643 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			643 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| ---
 | ||
| title: If Else Statement
 | ||
| localeTitle: 如果是其他声明
 | ||
| ---
 | ||
| # 如果是其他声明
 | ||
| 
 | ||
| If-Else语句根据您的前提条件是否已满,执行代码块。
 | ||
| 
 | ||
| ## 例
 | ||
| ```
 | ||
| if(boolean expression) 
 | ||
|  { 
 | ||
|  // execute this code block if expression evalutes to true 
 | ||
|  } 
 | ||
|  else 
 | ||
|  { 
 | ||
|  // always execute this code block when above if expression is false 
 | ||
|  } 
 | ||
|  
 | ||
|  
 | ||
|  int Price = 30; 
 | ||
|  
 | ||
|  If (Price = 30) 
 | ||
|  { 
 | ||
|   Console.WriteLine("Price is equal to 30."); 
 | ||
|  } 
 | ||
|  
 | ||
|  Else 
 | ||
|  { 
 | ||
|   Console.WriteLine("Price is not equal to 30."); 
 | ||
|  } 
 | ||
| ```
 | ||
| 
 | ||
| 由于我们已经宣布我们的int Price为30,这将是预期的产出。
 | ||
| 
 | ||
| ## 产量
 | ||
| ```
 | ||
| Price is equal to 30. 
 | ||
| 
 | ||
| ``` |