How can I make this code more efficient?

Hey
I’m trying to make a system for my game where you can buy a car for a certain amount of money
This is my current code

		if (Input.GetKeyUp(KeyCode.B))
		{
			Career_Variables.money -= Price;
			carChoosen = true;

			if (carSelected == 0)
			{
				Car0Bought = true
			}

			if (carSelected == 1)
			{
				Car1Bought = true
			}

			if (carSelected == 2)
			{
				Car2Bought = true
			}

		}

Obviously this isn’t efficient and could cause major problems if I had 30+ Cars.
Is there any more efficient way of doing this
Thank You

I sujest to use arrays and loops.
https://unity3d.com/ru/learn/tutorials/modules/beginner/scripting/loops

Use an array, or a generic List. So instead of a lot of separate variables, use a carBought boolean array, where each entry is true or false. http://wiki.unity3d.com/index.php?title=Which_Kind_Of_Array_Or_Collection_Should_I_Use%3F