4 ms·
> That awkward phase of internalizing that '=' is an assignment operator and is different from another operator meant to test equality gets a lot shorter for a
by nnq 11y ago
> That awkward phase of internalizing that '=' is an assignment operator and is different from another operator meant to test equality gets a lot shorter for a beginner.
I'll probably have to thank one of my highschool math teachers for inadvertently helping me skip this phase altogether then :)
He always pestered us to use the "equivalence" operators ⇔ or ≡ (the latter mostly for geometry stuff), and only use the regular equal when you had unambiguous contexts like "Let f(x) = x + 2" or "if x = 5". At the same time I was learning programming (with C++ as my first language...), and I could easily see "=" as being for assignment, since in other contexts you either used something more fancy (like ⇔ or ≡ in math, and "==" in code) or you used explaining words like "let" or "if" to clarify meaning. Though I think it took me a while to get things like `while (x = getch()) { ... }` :)
- nightcracker 11y agoI don't agree with your math teacher. ⇔ is not equivalence, it's a symbol for 'if and only if'. The left hand side implies the right hand side, and vice versa. Writing a * a - b * b ⇔ (a + b)(a - b) doesn't make any sense, because neither the left hand side nor the right hand side are logic statements.