Extract Variable

Extract code to a variable

The Extract Variable refactoring wraps a selected expression into a variable. Select an expression and press ⌥⌘V (on Mac) or Ctrl+Alt+V (on Windows/Linux).