Question: Can i use if else under a check constraint.

Can i use check constraint using a variable

need xplanation with eg.

Answer: 
You cannot use `IF/ELSE`, but you can use inline conditionals: `CASE WHEN`
Your question is a bit vague. What are you trying to do with the IF...ELSE? Check constraints aren't processed code, they're part of the table definition - there is no control flow and no variables. You can use a user-defined function in check constraints, which may be what you're after, but it's hard to tell from your question.