Step 1
Top
Previous
Next
Highlight the contents of the If clause, and then click
Extract Function