While Loop Crashing Editor

I am trying to use a while loop to move forward fast. This is my code:

void AMyCharacter::Fast()
{
	gofast = true;

	while(gofast == true){
		AddMovementInput(GetActorForwardVector() * 99999);
	}
}

void AMyCharacter::StopFast()
{
	gofast = false;
}

void AMyCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
	Super::SetupPlayerInputComponent(PlayerInputComponent);

	PlayerInputComponent->BindAction("Fast", IE_Pressed, this, &AMyCharacter::Fast);
	PlayerInputComponent->BindAction("Fast", IE_Released, this, &AMyCharacter::StopFast);
}

when i press the key to make it go fast the editor crashes and i am not sure why.

You are crashing the engine with an infinite loop. You need to figure out another way of doing this, like using tick or a timer instead.

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.

Isn’t a while loop a infinite loop anyways? isn’t that the point?

Here is an example of a while loop.

 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);

Good luck!

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.