Dear student ,
Non metals have the tendency to gain electrons. An electronegative element is one which attracts electrons towards itself and is capable to gain electrons and form anions. Non-metals like F, Cl, O are capable to gain electrons and form anions.
Regards