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
-
I like to do this:
if(
condition
)
{
// TODO copy and paste from stackoverflow
}
:) -
Have to say I prefer the opening brace on a line of its own; helps me to see the block because I know the open brace is in the same column as the close.
-
Akio647y@milkybarkid Its personal preference tho. Its just hard if someone else with other preferences starts working on it. But recently I needed to do this and i changed my preference for tabs. Needed to start using 1 space tabs instead of 4 and space after "if" which i didn't do normally
-
@Akio I find it's best to just conform to the project's coding style; makes it much more readable. For anything I'm writing from scratch, I have my own guidelines which I've in a document somewhere...
-
@Akio If you use VIM you can put a comment header in to define tabspacing, etc for that file, makes life so much easier:)
-
Akio647y@milkybarkid Yes I agree with that but sometimes it may be hard to switch between the styles and you start using the wrong style in the wrong project... Like if you code in lang A for a long time, then start using lang B again and you write something that only works in lang A because you were not mentally there 100%
-
Akio647y@milkybarkid I am one of those persons who doesn't know how 2 vim (should i learn it im fine with using nano) but you can do the same stuff in VSCode (which is what i use like 99% of the time right now) and that makes it handy so you can still just use tab.
-
joseglego407yWell, @pertroo you missed the indentation in the block. But it's ok! You're awesome too.
-
joseglego407y@joseglego, My bad @pertroo. devRant doesn't show the indentation in the web version. You're awesome :D
-
@cankarales Right here! :highfive !
And all my coworkers give me shit for it when I slip up, too.
You'd think there would be a whole set of tools dedicated to preformatting code when you load it, and converting it so it matches the style of the project it when you commit, but I've never seen anything like that actually in use.
if (condition) {
//code
}
if you place your brackets like this, you're an awesome individual. Let's be friends
undefined