Male Includes Female Bug
I see this in code : This wil make gender of all as "Male" if (gender?.toLocaleLowerCase().includes('male')) { profile.Gender = 'M'; } else if (gender?.toLocaleLowerCase().includes('female')) { profile.Gender = 'F'; } 10 replies how? i dont see any issue in this code snippet
A dark-mode code discussion shows a programmer claiming that checking whether a gender string includes “male” will classify everyone as male, followed by code that checks “female” afterward. The joke is that “female” contains the substring “male,” so the first condition catches it and the female branch never runs. It is shared as a humorous programming bug and a reaction to careless substring matching. EN: A dark-mode code discussion shows a programmer claiming that checking whether a gender string includes “male” will classify everyone as male, followed by code that checks “female” afterward. The joke is that “female” contains the substring “male,” so the first condition catches it and the female branch never runs. It is shared as a humorous programming bug and a reaction to careless substring matching.
- @rzeczyzabawne / 6127 2023-02-02
- Type
- image
- Size
- 800×775 · 59.2 KiB
- Mood
- sarcastic, absurd
- Language
- en
- Added