I feel like students have not specifically seen examples of both run time error and infinite loops. They know them by definition but not in application. As the Create task written responses might address these 2 topics I was hoping to show some examples using previous bubbles but I could use some help.
Would this be a run time error example? App Lab - Code.org
If anyone has made any projects addressing this, are you willing to share?
If not, are there any moderators that would be willing to make examples?
hmm well in normal cases by not referencing correct asset urls that are not defined would cause runtime errors CDO emits a warning that what your trying to do won’t work rather than completely not allowing the program to work anymore, what you could do is manually force a fatal error in your demo by doing this
if(topsIndex > 0){ // --- removing to create run time error
topsIndex = topsIndex - 1;
} else {
throw("invalid index");
} // --- removing to create run time error
or using incorrect prototype methods is a more common case of issues i’ve seen when answering questions so this might be better
var strs = ["a", "b", "c"];
console.log(strs.includes("n"));
i made it more obvious but this can be pretty obscure at times
your runtime error right now is a runtime warning it does not terminate the program from functioning I’d recommend using one of my modified examples
Varrience
Thank you so much for the suggestions. My students and I are not familiar with the throw command but I see what happens when I change my code. I am still not quite seeing how they would have a “run time error” without knowing the throw command (as it was not taught).
I see how trying to access an element outside the list length doesn’t really stop the app from running- it is really just a warning.
Still feel like I need to learn more on this. Ugghh!