The police said four men carried out the assault at Altcar Park in the Galliagh area just before 04:00 GMT on Thursday.
It is believed that one of the gang had a handgun. They escaped in a small silver car.
The victim did not need hospital treatment. Police have appealed for information.
A 24-year-old man has been beaten by an armed gang in a paramilitary-style attack in Londonderry.