A water heater is usually worth replacing rather than repairing once it is leaking from the tank itself rather than a fitting, once it is past roughly ten to twelve years old and the anode rod has not been maintained, or once it can no longer keep up with what the household actually uses, cycling through hot water faster than it used to, or taking noticeably longer to reheat. A fitting leak, a faulty thermostat or a bad heating element are repairable on a younger unit; a tank that is rusting or weeping from a seam is not.
In a condo or a smaller home, the right size tank is not automatically the same size as the one being replaced: household size and how many bathrooms run at once matter more than matching what was there before, which is part of what gets checked before a replacement is recommended.