Author Topic: Ternary Abuse  (Read 694 times)

Offline leeor_net

  • Administrator
  • Hero Member
  • *****
  • Posts: 1645
    • LairWorks Entertainment
Ternary Abuse
« on: October 13, 2016, 11:33:58 AM »
- Leeor
LairWorks Entertainment

Titanum UFO's

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4040
Re: Ternary Abuse
« Reply #1 on: October 13, 2016, 04:06:44 PM »
Lol. Bonus for adding that nonsense right next to already working code.


That kind of reminds me how new programmers tend to write:
Code: [Select]
bool flag;
if (notTerriblyComplicatedConditionExpression) {
  flag = true;
} else {
  flag = false;
}

Rather than the more compact:
Code: [Select]
bool flag = notTerriblyComplicatedConditionExpression;

Offline leeor_net

  • Administrator
  • Hero Member
  • *****
  • Posts: 1645
    • LairWorks Entertainment
Re: Ternary Abuse
« Reply #2 on: October 13, 2016, 04:57:30 PM »
I'm sure I've been guilty of that sort of beginner mistake in my hay days as a fledgling programmer.
- Leeor
LairWorks Entertainment

Titanum UFO's

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4040
Re: Ternary Abuse
« Reply #3 on: October 13, 2016, 08:59:02 PM »
We've all been guilty of that one.

Was great to see the light when I first learned you could just assign like that.

Offline leeor_net

  • Administrator
  • Hero Member
  • *****
  • Posts: 1645
    • LairWorks Entertainment
Re: Ternary Abuse
« Reply #4 on: October 14, 2016, 01:51:52 PM »
I remember coming up with something like that and thinking "There has to be a better way to do this" and realizing all of a sudden in that moment that I could use the expression itself as a yes or no type deal.
- Leeor
LairWorks Entertainment

Titanum UFO's