
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
Thank you guys for your help so far. Okay I guess I really don't need to "skip" a function like RaptorUK said.
I somewhat understand what Ickyrus' explanation. But when the function is terminated, where does it resume? Does it start from the very beginning again or what?
Thanks for the explanation, but I'm still a bit confused. Using the print functions I used in my example, can you explain the logic behind the code, why it returns to the beginning of the entire code when it executes return; and never gets to the end, even though it's a function.
Execution returns to the code immediately after the code that called the function.
In this example the sequence would be as follows . . .
1. function_a is called and if it returns true . . .
2. . . . function_b is called
3. regardless of function_b being called or not, start() ends and returns 0
Ok I will try again, BTW when the Bread function was executed that is you start following the instructions the function returns Bread.
Thank you guys again. Your examples are very clear. But, in RaptorUK's example, it returns to int start (), since it called the operator "return," in Ickyrus' example, the use of return also sends it back to int start(), but it is Print ("4") that called it? What accounts for the discrepancy?
Print("4") does not do any function it is a function in its own right its purpose is to send text characters to the journal tab.
return(0) is a command to fill a reserved memory location with a number and stop doing any further instruction that follow Doing the return command, that is instruction inside the functions definition. If 'shop closed' do the command 'turn arround'
Thank you guys again. Your examples are very clear. But, in RaptorUK's example, it returns to int start (), since it called the operator "return," in Ickyrus' example, the use of return also sends it back to int start(), but it is Print ("4") that called it? What accounts for the discrepancy?
Just in case it isn't clear . . . .
. . . no functions can be between the braces, the functions are declared outside of start(), what can go inside those braces are calls to the functions declared outside of start()
In the function start() when a return is encountered start() ends and the EA sits doing nothing just waiting for the next tick, when the next tick arrives start() is called again.
I've always understood the use of return in custom functions. Like your GetshoppingList() and GetDirectiontoShop(). But I still don't understand where will the EA return to if return is executed. How do I know what classifies a function as "worthy" of being returned too (in this case it's int Start())? I mean in the line: if(shopclosed), isn't that a function? Since you are checking true/false statements.
edit: see next page!