Skip to main content
VLAZ's user avatar
VLAZ's user avatar
VLAZ's user avatar
VLAZ
  • Member for 9 years, 2 months
  • Last seen this week
Stats
2,459
reputation
2k
reached
8
answers
3
questions
Loading…
About

To be, or not to be, that is the question

Translating it into code, we get

theQuestion = 2b || !2b

This returns true for any value of 2b, making the evaluation redundant. We can optimise it by removing the expression and substituting with the result.

theQuestion = true

1
gold badge
11
silver badges
12
bronze badges
46
Score
9
Posts
82
Posts %
15
Score
1
Posts
9
Posts %
13
Score
2
Posts
18
Posts %
13
Score
2
Posts
18
Posts %
12
Score
1
Posts
9
Posts %
12
Score
1
Posts
9
Posts %
Top posts
View all questions and answers