How to make a character Jump given a certain condition

Hi. I am recently working on a project where i am creating a quiz game with a mix of a platform animation. I want to make my player jump when i answer correctly a question, but i don’t know how to create a condition in C# in order to make him jump. Any ideas of how i can make it?

Maybe put in a Boolean called canJump and have it set to false to start with. When an answer is current set it to true.
Then in your player movement script have a condition where it can only jump if canJump is true. and after its jumped set it back to false if you want to limit them to only one jump, otherwise you could implement a counter to count the amount of jumps they can do.

bool answer = false;
Animator anim;
void Start()
{
answer = false;
anim = getComponent():
}
void Update()
{
if (answer == true)
{
anim.setTrigger(“jump”);
}
}

apply this script to your player gameobject.
anim is an Animator component. That contain multiple animations. And "jump" is your animation name.

Animator must be attach to your player gameobject.
setTrigger is parameter of your Animator. Here concentrate that your perimeter and state name of your animator must be same.