If it is produced from a flower and has a seed in its center then it is a fruit. This means that tomatoes, peas, beans, cucumbers, squash, avocados and cucumbers are all fruit, not vegetables.
On the flip side, vegetables are the edible roots, leaves or branches of the plant. Potatoes, celery, broccoli, beets, turnips, lettuce, kale…all vegetables.
Generally speaking, fruit is picked off the plant while vegetables are the plant.
This is the scientific definition. Most cookbooks, food guides and diets classify fruit and vegetables according to how they are used…hence the confusion!