but if 'return' terminates this function, then what is the need for the closing braces which succeed it?
The first return may be conditional on a block of code.
You may want to add additional code later for when the condition is not satisfied.
Your example may be a poor example as there is no more code after the Alert.
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
Still reading through the tutorial/manual, on the later stages now and have come across an example which has left me a bit confused.
'return' is of course used to terminate the current function... in this example, the special start() function is the only function used, but if 'return' terminates this function, then what is the need for the closing braces which succeed it? I know that a closing brace usually follows the 'return' operator but I thought that this was the closing brace of the function... in this example, 'return' is used prior to the closing braces of the external while(true) cycle and the OnStart() function (according to the program notes (//)).
Is there any difference between the above and below examples in terms of program execution? Is it acceptable to use the below code rather than the above to end the script?