VLAZ's user avatar
VLAZ's user avatar
VLAZ's user avatar
VLAZ
  • Member for 8 years, 6 months
  • Last seen this week
Stats
7,821
reputation
2k
reached
12
answers
5
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
10
silver badges
12
bronze badges
61
Score
13
Posts
76
Posts %
27
Score
2
Posts
12
Posts %
23
Score
2
Posts
12
Posts %
23
Score
1
Posts
6
Posts %
11
Score
4
Posts
24
Posts %
8
Score
2
Posts
12
Posts %
Top posts
View all questions and answers