Check out example codes for "t-sql if else". It will help you in understanding the concepts better.

Code Example 1

IF 1=1
	SELECT 1
ELSE
	SELECT 0
-- returns 1

-- Definition
IF Boolean_expression   
     { sql_statement | statement_block }   
[ ELSE   
     { sql_statement | statement_block } ]

Learn ReactJs, React Native from akashmittal.com