The primary function of a VLAN is to separate layer 2 traffic. Hosts in one VLAN cannot communicate with hosts in another VLAN without extra services. An example service is a router to pass packets between the VLANs.
Of course, one way of achieving these goals would be to connect each group of hosts to their own switch. This is sometimes done for management traffic.