One sloution to have something like this is to copy code fragment by code fragment or line by line and paste it in an interactive shell and see result .
But in my humble experience this won't fit for any kind of code design it fits for top down approach if your code contains a lot of jumping then this won't work