How to set variable value from another variable value?

Twine Version: 2.3.14
Story Format: Harlowe 3.2.2

I have a string variable called $king, and the default value of this variable is “Alexander”.
And I have another string variable called $name where player will set their own character names.
I want to make it so that the game will change the $king value from “Alexander” to the player’s chosen name.

I’m sorry if this is a very basic question, I’m very new to Twine and coding.
Thanks

For most values to assign the value of one variable to another is as simple as the following:

(set: $varA to $varB)

In this case, after $name has been assigned a value, you likely want:

(set: $king to $name)