Christian Stern: This would be cool:
That is valid code, just bad style. Equal vs equal equal is easily a typo.
int bufferRC = this.getBuffer(); if(bufferRC == -1) return false;
whroeder1:
That is valid code, just bad style. Equal vs equal equal is easily a typo.
Multiple expression in same line is equally bad style (no pun intended).
int bufferRC = this.getBuffer(); if(bufferRC == -1) return false;
Thank you for the comment. I found out, that this is working perfectly:
// define current buffer check int bufferRC; // get buffer if ( ( bufferRC = this.getBuffer() ) == -1 ) return false;
i like it compact. A good short definition of a method is helpful if you have complex stuff to do. Every extra line make it harder to read months ago or during troubleshooting. So i found out, that using "( )" breakets is like forking and the code inside will be handled first. Same with return handling.
Boring style:
if ( a == 1 ) { return true; }else{ return false; }
Nice style:
return ( ( a == 1 ) ? true : false );
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hey, goood morning ....
i'm trying to improve some code lines and i want to get reed of some code like this:
The method returns -1, 0 and eighter a 1 or a value greater then one. All values equals or greater than 0 is programm related where -1 one specifies a error. I dont like this blocks because normaly i put in a sperate line with a a comment above it but in this case it explans himself and dont need a comment. But having this in a single row makes the "code style" bit unharmonic. So i am looking for a smart solution. You have any ideas for me ?
This would be cool:
Thanks && Regards