Command-Query Separation "states that every method should either be a command that performs an action, or a query that returns data to the caller, but not both. In other words, asking a question should not change the answer."
a = [1, 2, 3]
last = a.pop
Here, in Ruby, the pop
command returns the item is popped off the Array.
This an example of a command and query within one method, and it seems necessary for it to be so.
If this is the case, is it really a code smell to have a method that is essentially a query as well as a command?