However, there are exceptions to this rule, especially for elements in the first and second rows of the periodic table:
* Hydrogen and Helium: They only need 2 valence electrons to fill their outermost shell and become stable.
* Elements with less than 4 valence electrons: They tend to lose these electrons to achieve a stable configuration.
* Elements with 5 or more valence electrons: They tend to gain electrons to complete their octet.
The octet rule is a helpful guideline, but it's important to remember that it's not always strictly followed.