1. You need to be more specific with the question, at least specify the language involved in Relevant Tags.
2. `if` statement is used for evaluating expressions for branching execution flow. It was not meant for variable initialization.
If you can, explain what you want to do, perhaps I can help you just a bit. There's no need to mark my answer, I haven't helped you with anything.