No not really. It still needs a way to eventually come out of it. Its a loop that does something while something else is being done (implying that it will finish on its own). When you enter your loop even for just a few seconds it will execute millions of times and detects an inifinit loop and crashes because nothing is saying that things will change for it to break out. Most loops do not need to be run a million times before breaking out.
int i=1;
/* The loop would continue to print
* the value of i until the given condition
* i<=6 returns false.
*/
while(i<=6){
cout<<"Value of variable i is: "<<i<<endl;
i++;
}
I think you can probably have a scaling float value that can be your fast speed and remove the while loop.
// toggling fast speed
if(e is pressed)
fastSpeed = 99999;
// removing fast speed
if(x is pressed)
fastSpeed = 1
// Your move function
AddMovementInput(GetActorForwardVector() * fastSpeed);
The game has to finish executing all the functions you call before it can go to the next Tick and do the next frame.
A while loop will run infinite times before the next frame of the game can move.