Hi daisym, yes you can. Fruit and vegetables contain calories and a calorie from fruit or veg is not different to a calorie from chocolate, but in total chocolate contains a lot more calories than the fruit or veg. So if you were to eat a lot of fruit or veg then you could reach or exceed the recommended calorie intake for you and exeeding this limit will cause you to gain weight. Fruit is very high in sugars and whilst these are naturally occuring sugars rather than added sugars your body doesn’t recognise such an intake so you keep eating more and more.
But fruit and veg are full of nutrients and vitamins and fibre which our bodies need so it’s very important to get your 5 a day!