Motors as Parameters

Hi everyone!
I want to make a function called toggle that accepts a motor name and btn as parameters.
This way I only have to write my toggle code once.

Is there a way to do this?

bool shift = false;
void toggle(string motor, string btn)
{
	if(vexRT[btn] == 1)
	{
		if(!shift)
		{
		motor(m) = 65;
		shift = true;
	  }
	  else if(shift)
	  {
	  	motor(m) = 0;
	  	shift = false;}
	}
}
task usercontrol()
{

	while (true)
	{
	  	toggle(flap, Btn5D);
	
	}
}

never mind I figured it out


void toggle(tMotor m, TVexJoysticks btn)