VLAZ's user avatar
VLAZ's user avatar
VLAZ's user avatar
VLAZ
  • Member for 8 years
  • Last seen this week
Stats
7,824
reputation
2k
reached
11
answers
4
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
9
silver badges
11
bronze badges
52
Score
12
Posts
80
Posts %
27
Score
2
Posts
13
Posts %
23
Score
2
Posts
13
Posts %
23
Score
1
Posts
7
Posts %
11
Score
3
Posts
20
Posts %
6
Score
1
Posts
7
Posts %
Top posts
View all questions and answers