Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
As long as there are braces and they are consistent within the project, it's fine.
-
jobylie67066y@Alice ok this makes sense. Probably looks ugly to me bc I am used to doing it differently
-
bioDan61596y@jobylie you are right to assume different coding sryles for different programming languages, also depending on the coding style emphasis of the repository
-
This is what I do. With proper indentation of course.
Putting an 'else' on its own line just waists space -
@Kalex just what we were discussing the other day...some people just like to watch the world burn!
-
@Alice braces on a separate line is the standard for C#. If I'm writing C#, I do it that way. If not, I use the braces like in the post (standard for Java, JS, CSS, etc.).
All depends on the language standard! -
iamgio38326ySwitched to else in the same line some weeks ago. It's the best way (for me) because you clarify easier what the main if is
-
Well I mean, Rust won't let you do it without, as this is the syntax;
if condition {
// lol
}
Using parens on the condition won't allow you to drop em, but you are encouraged to use inline if/elses in some places -
koin5886y@sharktits It's famous from K&R and the C book they wrote so it's called the K&R indentation and btw it's the right indentation.
Related Rants
-
Andi5Whenever a friend is raging over some bug i'm like: Calm down... relax... write a rant... get schwifty...
-
GIS-Jedi2Having a co-worker who I consistently must support with using the basic funionaity of our software, getting me...
-
badcopnodonuts8My job title should be Fireman. Seriously, the only reason I think my boss makes such stupid fucking decisions...
This is how my prof uses braces:
If () {
test;
} else {
test2;
}
He uses it as an example of how to use line breaks properly.
rant
infuriating