Author Topic: refactoring method to take an expression and extract it to a variable  (Read 1091 times)

flethuseo

  • Senior Community Member
  • Posts: 176
  • Hero Points: 2
I am not sure if there's already a command in Slickedit to do this or not, but I've seen it in other IDEs. It takes an expression determines what it returns and replaces it with a variable. I find this command pretty useful, even if it only does simple expressions like capturing the returned value from a function. As an example:

I have this expression highlighted, and countRows returns an integer I want to replace it with a variable:
return [entity->countRows(constraint);] (highlighted area between brackets)

like so:
int var1 = entity->countRows(constraint);
return var1;