Description Usage Details Author(s) See Also Examples
Run the current line of code in rvenv$currcode as indicated by the program counter rvenv$pc.
1 | nxt()
|
This function executes the current line of code in rvenv$currcode as indicated by the program counter rvenv$pc. After execution, rvenv$pc will be incremented to point to the next line.
A restriction is that the line being executed cannot contain one of the starting or ending braces of a function, loop, or conditional block (such as an if or else clause) and not the other. This is because the line is executed as an independent block of code. If it contains only one of the opening and closing braces of a function, loop, or conditional block, it will not by syntactically valid. The use of nxt
, along with the more general runb
, can be seen by running the following sample program:
1 2 3 4 5 6 7 8 9 10 11 |
Because of the restrictions, runb
must be used to run through line 9. That's because all of those lines except for 2, 5, and 8 contain one of an opening or closing brace but not the other. However, nxt cannot be used to run those lines because there is no standard way to get the program pointer rvenv$pc to point at any of them. However, nxt
can be used to execute the last two statements as shown in the following test run that uses the smallest possible steps to step through the entire program:
1 2 3 4 5 6 7 8 9 10 11 12 |
As can be seen, nxt
was used to execute the last two statements and the expected result was output in both cases.
Norm Matloff
edt
loadb
makebranch0
runb
rvinit
saveb
1 | nxt()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.