On an indictment or information on which the defendant is to be tried for any offense the jury may convict the defendant of:
(a) an attempt to commit the offense if such attempt is an offense and is supported by the evidence. The judge shall not instruct the jury if there is no evidence to support the attempt and the only evidence proves a completed offense; or
(b) any offense that as a matter of law is a necessarily included offense or a lesser included offense of the offense charged in the indictment or information and is supported by the evidence. The judge shall not instruct on any lesser included offense as to which there is no evidence.