Learn creative coding writing simple programs
147. Let's make errors II (nullPointerException, arrays, logic)
This is one of those videos where we unfortunately don't do any amazing graphics. But we do something almost as fun: we provoke errors. I hope that by seeing errors happen you can identify them and fix them quickly when they happens to you.
In part II we take a look at nullPointeExceptions, which happen when you try to access a variable that has not been initialized. We also see what happens when you try to access array elements that do not exist, and finally we take a quick look at logic errors: programs with the correct syntax, but unexpected behavior.
This is really a quick overview, as there are lots of things that can go wrong in programs. Try to learn from your mistakes! :)
You can read about software bugs (and find out where the word comes from) in Wikipedia: https://en.wikipedia.org/wiki/Software_bug
Code editor
background
boolean
color
colorMode
draw
fill
float
for
frameRate
height
if
int
mousePressed
noStroke
popMatrix
pushMatrix
rect
rectMode
rotate
setup
size
stroke
strokeWeight
translate
void
width
Try to stay close to the topic of this episode. Use the Processing forums for help with unrelated Processing projects (or hire me for help ;-)
To indicate that a word in your comment is code, use the `backtick`. Example
Do `float` and `int` smell similar?
To highlight code blocks, surround it with ``` code-fences ``` like this:``` void setup() { size(600, 600); } ```