4

I know you read equality == in if (x == 5) this way:

If x is equal to 5 . . .

But how do you read it in a coding context (assignment); i.e. = in x = 5?

5
  • I would say "5 is assigned to x", or "x is filled with 5"... but I'm not native english. In my native language (french), there is no way to say it "nicely". We would better talk of "x is initialized to 5".
    – Random
    Commented Aug 7, 2015 at 8:18
  • I would say for X equal to 5 Commented Aug 7, 2015 at 8:28
  • 1
    The first question (which nobody asked) should be: What programming language is this, that uses double "=" signs? Because yours is not a question about English; it is about that programming language. In BASIC , assigment is "LET A=B" (let A equal B) In C, you can say things such as "B++" (increment B). How you say it has nothing to do with English rules; it depends on the programming language's syntax. Commented Aug 8, 2015 at 10:09
  • 1
    I’m voting to close this question because this is not a question of "English" but strictly field specific. The point of code is to avoid the ambiguity of natural language. So asking how to render computer code in natural language is quixotic
    – James K
    Commented Feb 14 at 11:47
  • 1
    @JamesK I think if we limited the question to math, it's OK as a "how do I read this aloud" question, but I agree that how to read code aloud is out of scope (especially since x = 5 could mean different things in different programming languages).
    – ColleenV
    Commented Feb 14 at 12:20

2 Answers 2

6

There are very minor differences but they are basically the same:

Comparison

if (x == 5)

Is pronounced - if x is equal to five

Assignment

x = 5

Is pronounced - x equals five

Another, more technical way (the above is a colloquial term) is set x to five.

6
0

Programming Answer:

If (x == 5) { (code) }

tells the computer:

If (x is equal to 5) { Do this code }

While

x = 5

tells the computer

The variable x currently has the value of 5. (Anywhere the variable "x" is used the value of 5 will replace it unless x is changed later)

The reason we use "==" for "equals" is because we had already decided that " = " means "is assigned to"


Math Answer

In algebra and calculus "x = 5" would be "x equals 5"

2
  • So how do pronounce eventually? the same algebra way? Commented Aug 7, 2015 at 8:36
  • 1
    I always say x=5 as "x equals five" @Milad even though it is technically incorrect.
    – SolarLunix
    Commented Aug 7, 2015 at 8:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .