So I'm feeling pretty damn awful today (some sort of throat cough) and I made literally the most elementary programming mistake in existence:
I honestly can't remember the last time I wrote one equal sign instead of two.. it's been years. I'm pretty embarassed, but I blame it on my health.
So tell us, when's the last time you wrote '=' instead of '=='?
Equality vs. Assignment
Moderator: Talkative People
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Equality vs. Assignment
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
- bbguimaraes
- Chaos Rift Junior
- Posts: 294
- Joined: Wed Apr 11, 2012 4:34 pm
- Programming Language of Choice: c++
- Location: Brazil
- Contact:
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Equality vs. Assignment
The funniest part is this isn't my code base and I was trying to conform to someone else's style. I would *never* write "if(x == false)" in my own code, I'd just use "if(!x)".
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
- superLED
- Chaos Rift Junior
- Posts: 303
- Joined: Sun Nov 21, 2010 10:56 am
- Current Project: Engine
- Favorite Gaming Platforms: N64
- Programming Language of Choice: C++, PHP
- Location: Norway
Re: Equality vs. Assignment
One time I was sick, I actually wrote if(x != true)
It's been a while since I wrote only one =, but when it happens, it takes forever to find the mistake, because who the fuck would think they wrote only one =? xD Always the last place I look.
It's been a while since I wrote only one =, but when it happens, it takes forever to find the mistake, because who the fuck would think they wrote only one =? xD Always the last place I look.
-
- ES Beta Backer
- Posts: 4
- Joined: Sun Jan 25, 2015 10:27 pm
Re: Equality vs. Assignment
dandymcgee wrote:I would *never* write "if(x == false)" in my own code, I'd just use "if(!x)".
At the end of the day it doesn't matter because your compiler will optimize away stuff like that.superLED wrote:One time I was sick, I actually wrote if(x != true)
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Equality vs. Assignment
It does matter, because on makes it easier to make the assignment mistake. Also, I had just gotten done updating some vb code.. and in vb a single '=' is the correct syntax. Ugh, I hate vb.zeroandnull wrote:dandymcgee wrote:I would *never* write "if(x == false)" in my own code, I'd just use "if(!x)".At the end of the day it doesn't matter because your compiler will optimize away stuff like that.superLED wrote:One time I was sick, I actually wrote if(x != true)
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!