Upon an indictment or information for an offense consisting of different degrees, the jury may find the defendant not guilty of the degree charged in the indictment or information, and guilty of any degree inferior thereto, or of an attempt to commit the offense.