Posted: Mon Sep 10, 2012 10:09 pm Post subject: RE:Turing Get Statement Timer
You can't declare a procedure inside a loop.
Sponsor Sponsor
QuantumPhysics
Posted: Tue Sep 11, 2012 7:37 am Post subject: RE:Turing Get Statement Timer
Is a procedure in turing the same as a function in C/C++?
Raknarg
Posted: Tue Sep 11, 2012 9:43 am Post subject: RE:Turing Get Statement Timer
Yes. In turing, they have both procedures and functions, but the difference is taht a function will produce a result at the end, where a prodecure simply ends. I believe in C++ when someone wants to accomplish that they make function that just results 0 and does nothing with it.
It's not necessary, but I think the creators of turing thought it would make more sense to make separate options.
2goto1
Posted: Tue Sep 11, 2012 10:01 am Post subject: RE:Turing Get Statement Timer
The thought process for Turing having functions and procedures as separate entities can be summarized in the function help documentation found at http://compsci.ca/holtsoft/doc/function.html.
Here is the relevant portion:
In principle, a function (1) should not change any variables outside of itself (global variables) or (2) should not have var parameters. In other words, it should have no side effects. The original implementation prevented (1) and (2) and thereby prevented function side effects. Current implementations of Turing do not enforce this restriction.
Some languages today still actually enforce this type of rule. But I'm only familiar with database languages enforcing this type of rule today, typically for database query optimization / performance purposes.