Please tell me, after break in operator for (i; i>0; i--) expression "i--" or just "expression 3" (according to documentation) is executed? I couldn't find it in the textbook.
I don't understand why "-1" is thrown from time to time if after the break the Print(i); before the break there is i-- and if (i==0), that is the exit command if i has already reached 0 inside the operator. Since i is used even further down the code, in Close[i], it produces the error "out of range
Ivan Butko operator for (i; i>0; i--) expression "i--" or just "expression 3" (according to documentation) is executed? I couldn't find it in the textbook.
I don't understand why "-1" is thrown from time to time if after the break the Print(i); before the break there is i-- and if (i==0), that is the exit command if i has already reached 0 inside the operator. Since i is used even further down the code, in Close[i], it produces the error "out of range
Ivan Butko operator for (i; i>0; i--) expression "i--" or just "expression 3" (according to documentation) is executed? I couldn't find it in the textbook.
I don't understand why "-1" is thrown from time to time if after the break the Print(i); before the break there is i-- and if (i==0), that is the exit command if i has already reached 0 inside the operator. Since i is used even further down the code, in Close[i], it produces the error "out of range
After the break, exit the loop to the next operator after the loop, after the loop iterates to the end of the iteration at that point and starts a new one.
Don't ask me what kind of nonsense I'm writing in my code. I just want to understand the nuances of this operator) It seems that in the body I specified "it's time to leave here, because i=0", but the operator takes and once again executes the expression, although it should pass control to the next operator
Don't ask me what kind of nonsense I'm writing. I just want to understand the nuances of this operator) It's like in the body I specified "it's time to leave here, because i=0", but the operator takes and once again executes the expression, although it should pass control to the next operator
Yes you did, but you took it away before this check. Write it this way
i=10;
for (i; i>0; i--)
{
if (i==0) break;
i--;
}
Print(i);
Print(Close[i]);
Of course, the program is not waiting for the terminal in a separate thread to log some data.
Thanks, I mean
I don't understand why "-1" is thrown from time to time if after the break the Print(i); before the break there is i-- and if (i==0), that is the exit command if i has already reached 0 inside the operator. Since i is used even further down the code, in Close[i], it produces the error "out of range
I don't understand why "-1" is thrown from time to time if after the break the Print(i); before the break there is i-- and if (i==0), that is the exit command if i has already reached 0 inside the operator. Since i is used even further down the code, in Close[i], it produces the error "out of range
I don't understand why "-1" is thrown from time to time if after the break the Print(i); before the break there is i-- and if (i==0), that is the exit command if i has already reached 0 inside the operator. Since i is used even further down the code, in Close[i], it produces the error "out of range
After the break, exit the loop to the next operator after the loop, after the loop iterates to the end of the iteration at that point and starts a new one.
{
i--;
if (i==0) break;
}
Print(i);
Print(Close[i]);
// In the log it says (-1), how come... and, hence, the errorarray out of range, because Close[-1] doesn't happen.
I mean, am I right in understanding that after break in the header(i; i>0; i--) the third expression "i--" is still executed?
{
i--;
if (i==0) break;
}
Print(i);
Print(Close[i]);
// The log says (-1), how so... and, hence, the errorarray out of range, because Close[-1] does not happen.
I mean, am I right in understanding that after the break in the header(i; i>0; i--) the third expression "i--" is executed anyway?
Correctly writes
You take away not only in the header, but also in the body of the loop.It writes correctly.
Don't ask me what kind of nonsense I'm writing in my code. I just want to understand the nuances of this operator) It seems that in the body I specified "it's time to leave here, because i=0", but the operator takes and once again executes the expression, although it should pass control to the next operator
Don't ask me what kind of nonsense I'm writing. I just want to understand the nuances of this operator) It's like in the body I specified "it's time to leave here, because i=0", but the operator takes and once again executes the expression, although it should pass control to the next operator
Yes you did, but you took it away before this check. Write it this way
there will be a different result
Yes you did, but you took it away before this check. Write it like this
aah... got it. Got it.
Thank you all for your prompt replies.
ahh... Got it. Got it.
Thank you all for your prompt replies.
Your code prints 0, not -1...
Probably -1 printed from somewhere else, most likely the whole code is in the printers...
Before you try to solve the problem, you need to identify it... Make sure it's there and locate it before you solve it...