Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

You don't need break in default statement #311

Open
prietales opened this issue Jan 10, 2022 · 24 comments
Open

You don't need break in default statement #311

prietales opened this issue Jan 10, 2022 · 24 comments

Comments

@prietales
Copy link

@G2G2G2G
Copy link

G2G2G2G commented Jan 10, 2022

lmao, shitty code.. what do you expect from npm

@prietales
Copy link
Author

prietales commented Jan 10, 2022

troll?

@prietales prietales changed the title You don't need break in break statement You don't need break in default statement Jan 10, 2022
@richRemer
Copy link

You also don't need line breaks or most whitespace in code, but people do it for readability and style.

@prietales
Copy link
Author

prietales commented Jan 10, 2022

I'm sorry, but your argument doesn't fit in this case. Break is not necessary and it is not good practice, default is the last statement and you do not need to do any break as there will NEVER be a next statement, so more than helping, it creates confusion and hurts the eyes.

@richRemer
Copy link

That sounds like a well-thought out opinion. But it's still just an opinion. Can you provide sources or any evidence to backup your claims that it's not good practice?

@prietales
Copy link
Author

You just have to read a few basic and advanced javascript books and see any example on the internet, you will never see the break in the default because it is not used that way. That it can be put on does not mean that it is the right thing to do. Putting a break in the default does not contribute anything, it is confusing and not understanding that a next statement is not really expected.

@richRemer
Copy link

It helps avoid issues during refactoring. Still waiting for actual citations to back up your personal opinion.

@dhilt
Copy link

dhilt commented Jan 11, 2022

Well, basically it is the case https://www.crockford.com/code.html

Each group of statements (except the default) should end with break, return, or throw.

Though it still can be treated as an opinion and I personally would not care at all... Anyway, instead of making multiple issues, I'd suggest @prietales create single Pull Request for such updates 😅

@prietales
Copy link
Author

prietales commented Jan 11, 2022

"Each group of statements (except the default) should end with break, return, or throw."

You're not always going to need every statement to end,
Do you really think it's always necessary?
Sometimes you want that a code apply to common conditions...
It should, not it must.

You always need to put break before default statement, but not inside.

You never need break in default statement. The engine does not interpret it, it is useless code. NOT MY PERSONAL OPINION.

You cannot defend the indefensible and say that it is better to refactorize, speak without understanding in which cases it is good.

@richRemer
Copy link

"You always need to put break before default statement, but not inside."

Well, that's just flagrantly wrong. Maybe you should just close this before making yourself look dumber than you already have.

@prietales
Copy link
Author

prietales commented Jan 11, 2022

NO,

'default' is only reserved for the list of conditions that do not meet, in fact, good practices say that you should throw an exception in the default. If you put a return, you don't need break before default.

@pro465
Copy link

pro465 commented Jan 12, 2022

@prietales you dont need to force others to do things the way you like them. you need to realize that people can have opinions and style different from yours.

@prietales
Copy link
Author

prietales commented Jan 12, 2022

It is not a question of opinions. There is a thing called good practices and it is a consensus reached by programmers after thousands of hours of work.

@prietales
Copy link
Author

@pro465

theyre just Twitter trolls from the infinite loop incident. this isn't a real issue. they're being purposefully controversial for shits and giggles to spruce up their sad life. dont get sucked in

Please always use break in default statement. You are a PRO.

@richRemer
Copy link

@prietales if you put in a PR with unit tests, I'll make the changes to the code you've requested.

@prietales
Copy link
Author

@prietales if you put in a PR with unit tests, I'll make the changes to the code you've requested.

This project is dead and you are nobody.

@richRemer
Copy link

@prietales is too junior to understand the difference between what he's comfortable with and best practices. @prietales should probably try a code academy or something so he/she/it can learn to understand the discussion.

@prietales
Copy link
Author

prietales commented Jan 12, 2022

Children adore their guru.

@prietales
Copy link
Author

Break inside default and switch inside a for, for likes break statement.

@pro465
Copy link

pro465 commented Jan 16, 2022

All juniors together now.

children adore their guru and shitty code.

yeah, while you act like a guru and force others to conform. the irony is real here.

@prietales
Copy link
Author

I am not a guru nor do I want to be. I expose the reality that anyone who is not a junior can see a simple view. If you feel identified by something it will be.

@pro465
Copy link

pro465 commented Jan 17, 2022

@prietales

I am not a guru nor do I want to be. I expose the reality that anyone who is not a junior can see a simple view. If you feel identified by something it will be.

and yet, when people say that others can have different opinions, you refer to them as gurus, while denying that you yourself are being a guru by forcing your opinions upon others and labeling them as so simple that "anyone who is not a junior" should be able to see them.

unless you can give data and evidence, they just remain your opinions, not bona-fide facts.

@pro465
Copy link

pro465 commented Jan 17, 2022

i did not come here to argue and have my mind molded into an average person on twitter, so bye everybody, im gonna unsub from this thread.

@Ae3NerdGod have a nice day.
@prietales forget whatever i said, and have a nice day.
@Marak i dont know if the rumors about you are true, but i wish you a nice day, because, even if they are true, atleast I'm a human, and so I'm obliged to show everybody love ❤️ .

@Potherca
Copy link

  1. I call troll
  2. Show us any source to back up your opinion
  3. Put your money where your mouth is and open an MR

🙄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants
@Potherca @richRemer @prietales @dhilt @G2G2G2G @pro465 and others