We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm pretty much using the keyTyped() example from the p5 example and getting an invalid left hand assignment error in console... this line causes it: (even when I use "==" instead of "===")
if (key === 'p' && paused = false){
ideas?
thanks!
Answers
Yup! Pay attention to the
&&
's 2nd operand:paused = false
.It's assigning
false
to variable paused instead of checking whether paused isfalse
! #-oI believe the following is 1 of the ways of doing what you were expecting: :-B
if (key == 'p' & paused == false) {}
:-bdA shorter 1:
if (key == 'p' & !paused) {}
;)