To quickly wrap a code block in useful constructs, select it in the editor and press &shortcut:SurroundWith; (Code | Surround With ).

The list of available options or wrappers is context-sensitive and depends on the language.

wrap code into the if statement