A goldfish has a primitive digestive system requiring a special diet.
Bettas and goldfish are perhaps the most popular species for the novice aquarist, but the fish types require vastly different housing and nutrition. A goldfish needs a tank of 10 gallons or larger and enjoys cool water that is well-aerated. Bettas thrive in smaller, warmer tanks. You won't kill goldfish by substituting betta food for one or two feedings, but the goldfish's digestive system and long-term nutrition needs are much different from a betta's.
What's the Difference
Goldfish are omnivores, requiring both vegetation and protein in their diet. By contrast, bettas are carnivorous. Commercial foods designed for bettas contain high amounts of protein. Goldfish have slower digestive tracts - so ingesting a high-protein food designed for a betta can lead to intestinal gas, swim bladder infection and kidney failure if goldfish consume it regularly. Goldfish food contains slow-digesting plant matter and amino acids designed for goldfish's primitive digestion.
If You Run Out of Food
If you run out of goldfish food and won't get to the store in time for your goldfish's next meal, you can substitute unsalted peas. Pop a well-cooked pea from its skin, mash it slightly and drop it in the aquarium. Fresh lettuce, clipped to the side of the tank, makes another goldfish-friendly meal. Keep duckweed or other goldfish-friendly live plants in your aquarium to provide supplemental nutrition.