Building a scale is based off a mathematical formula
Half steps are the smallest steps you can make in music e.g. C to C#. C through C has 12 notes in the Western music system. A whole step would skip that C# and go straight to D.
root, whole step, whole step, half step, whole step, whole step, whole step, half step to high root. You can apply this formula to all major scales.
By using this formula you can quickly find out how many sharps or flats occur in any scale.
The major scale has to follow the alphabet – The Consecutive Alphabetical Rule. You can’t skip or repeat letters. Western notes go A through G.
A scale will always have all sharps or all flats – it won’t combine the two.