VLAZ's user avatar
VLAZ's user avatar
VLAZ's user avatar
VLAZ
  • Member for 7 years, 6 months
  • Last seen this week
Stats
1,150
reputation
14k
reached
9
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

2
gold badges
11
silver badges
22
bronze badges
20
Score
4
Posts
33
Posts %
20
Score
3
Posts
25
Posts %
16
Score
3
Posts
25
Posts %
13
Score
1
Posts
8
Posts %
12
Score
2
Posts
17
Posts %
10
Score
2
Posts
17
Posts %
Top posts
View all questions and answers