A visa can be defined as a legal title delivered by any country to a foreigner which permits the entry, stay or transit through the country. Visa can be issued for study, work, vacation, and medical reasons. It looks like a stamp or can be a separate document.
A residence permit gives rights to a foreigner to live in a country. There is always a validity in the residence permit and a person can stay until that date if that residence permit is not renewed. There are different advantages of having a residence permit like living legally in the country, buying real estate, conducting business, traveling freely, using medical services, and much more.