The term fruit has many different meanings depending on context. In botany, a fruit is the ripened ovary—together with seeds—of a flowering plant.
Vegetable is a term which generally refers to an edible part of a plant. The definition is traditional rather than scientific and is somewhat arbitrary and subjective. All parts of herbaceous plants eaten as food by humans, whole or in part, are normally considered vegetables. Mushrooms, though belonging to the biological kingdom Fungi, are also commonly considered vegetables. In general, vegetables are thought of as being savory, and not sweet, although there are many exceptions. Nuts, grains, herbs, spices and culinary fruits (see below) are normally not considered vegetables.
Since “vegetable” is not a botanical term, there is no contradiction in referring to a plant part as a fruit while also being considered a vegetable. Given this general rule of thumb, vegetables can also include leaves (lettuce), stems (asparagus), roots (carrots), flowers (broccoli), bulbs (garlic), seeds (peas and beans) and botanical fruits such as cucumbers, squash, pumpkins, and capsicums (bell peppers). Botanically, fruits are reproductive organs (ripened ovaries containing one or many seeds), while vegetables are vegetative organs which sustain the plant.
The question "is it a fruit, or is it a vegetable?" has even found its way into the United States Supreme Court, which ruled unanimously in Nix v. Hedden, 1893, that a tomato is a vegetable for the purposes of 1883 Tariff Act, although botanically, a tomato is a fruit.
Commercial production of vegetables is a branch of horticulture called olericulture.