CLion
 
Get CLion
You are viewing the documentation for an earlier version of CLion.

Extract/Introduce variable

Last modified: 21 July 2022

The Extract Variable refactoring puts the result of the selected expression into a variable. It declares a new variable and uses the expression as an initializer. The original expression is replaced with the new variable.

You can select the expression to be replaced with a variable yourself. You can as well use smart expression selection In this case CLion will help you select the desired expression.

This refactoring is available for C/C++, Objective-C/C++, Python and JavaScript.