Doubt in Programming (not repeating code)