# Set X to v? or Set X as v?

I'm writing an academic paper, and would like to say that the value of X is v using imperative form. (Specifically in the algorithm section. That's why I need to use imperative.)

Which among the followings is the best?

Set X to v.

Set X as v.

Set X v.

In programming, set X to v is a common idiom to mean changing the value of X to become v. Here's an example:

The Set X to () block is a Motion block and a Stack block. The block changes its sprite's X position by the specified amount. - Scratch Progrmaming Wiki

The form set X as v is not as familiar to me, but it does occur and can be understood the same way. However, it can also be (and arguably, is naturally) understood in the opposite way. In the following example, X is used as the CAS variable (i.e. like set CAS to x):

For Part 6, we will use X as the CAS variable. ...
To set X as the CAS variable ... - Eddie's Math and Calculator Blog

The form set X v is ungrammatical. In scholarly work, it would require prior agreement / definition of the convention.

Here's another form you could try:

Let X = v.

This form is unambiguous and is commonly used in mathematics and mathematical publications, and it is idiomatic among programmers.

You could be a little more nuanced about selecting the way depending on how X is set using v and the data types involved. For example, if X and v were reference types, it makes more sense to me to use "to", and "as" if they were value types. e.g. "Set X (integer) as v (number 5)" and "Set X (interface) to v (an instantiated object)". "Set X v" on the other hand sounds a little incomplete.