Learn creative coding writing simple programs

57. A random sentence generator writes nonsense

The improved version of the silly poet can save images to the hard drive when we press a key on the keyboard. It also generates a new sentence when we click the display. That means we must listen to keyboard presses using the keyPressed() function, and we also listen to the mouse clicks using mousePressed(). Both of these functions require that a "void draw()" function exists in our program, even if it's empty. If there is no draw() function, then mousePressed() and keyPressed() will never be called, and you will wonder why :)

Tags: random, words, sentence, absurd, strange, crazy, weird, silly, funny, LOL

Code editor

You can make changes to the code below. Then

Questions and comments

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); } ```