How to edit the number of sides that make up a shape?

So let’s say, for example I want to create a cylinder but with only 8 sides, so it’s more like an octagonal prism. Any quick way to do this?

Shift+A / Add Cylinder
Set number of sides etc from the options in the toolshelf (T) or F6