How can I use a navmesh with keyboard input to move an object?

There seem to be several tutorials for using navmesh to move a player with the mouse, but I want to use the keyboard arrow keys? Do I need to calculate the position to move too then use GetComponent().destination = calculated position?

float horInput = Input.GetAxis(“Horizontal”);
float verInput = Input.GetAxis(“Vertical”);
Vector3 movement = new Vector3(horInput, 0f, verInput);

    Vector3 moveDestination = transform.position + movement;

    GetComponent<NavMeshAgent>().destination = moveDestination;

Put this code in the Update function.

We are basically getting the input. Storing it in Vector 3. Calculating the position to move and store it as a Vector 3. And updating the navmeshagent’s destination.