long line of code

Created at 16 Nov 2014, 09:42
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
NE

newrick1962

Joined 16.11.2014

long line of code
16 Nov 2014, 09:42


If I have a long line of code (complex if statement or a long Print line) how do I split the code over more than one line?

Thanks
 


@newrick1962
Replies

AlexanderRC
19 Nov 2014, 15:28

RE:

newrick1962 said:

If I have a long line of code (complex if statement or a long Print line) how do I split the code over more than one line?

Thanks
 

C# syntax allows you insert new lines almost everywhere you like. As an extra precaution precaution I advise you to start a new line which part of statement with an operator (arithmetic, logic, etc.) which is part of an original statement. Adding an indent before the operator would be helpful too, but that depends on you code style. If you later go back to the code to read and modify it, it would be obvious that the line is a part of multiline statement due the leading operator.

Also see C# Coding Conventions. There are some example how a statement can be split.


@AlexanderRC