There are priorities that have to be considered. The functional group with the higher priority will be considered first. Almost everything has a higher priority than alkenes/alkynes except alkanes. The list of the priorities can be found on the internet and I think its in the Kaplan BB. But I think it goes like this: Carboxylic acids > Esters> Acyl Halides > Amides > Nitriles > Aldehyes > ketones > alcohols > amines > alkenes/alkynes > alkanes. For example, in 4-heptene-2-ol, the alcohol has the lower number because it has a higher priority than the alkene.