All of those answers up there . . . dumb. It depends on how big your tank is and what is in it. For example: You can put a great white shark in the same tank as a clownfish. They will both survive to their fullest potential if the tank is set up correctly.
Bettas are the pitbulls of fish. They get a bad name from ignorant people.
My first tank was a 30 gal. community with various tropical fish including a betta and 2 inch (mouth to tail) angelfish.
Because I had plants, stones, etc, the fish used those as boundaries to their own little territories.
My problem fish were the mollies. I will never recommend mollies to anyone. A platy is a safer, hardier, more attractive alternative.
Many pet stores/fish stores will offer a guarantee on your fish. If you are 100% sure your water is safe, I recommend trying the combination, if you have a 1 inch/1 gal ratio or less. (For every square inch of fish should have at least a gallon) Otherwise you may be crowding. If you notice signs of aggression separate the newly bought fish and attempt to return it to the store immediately to ensure its survival.