String[] elements = { "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon" }; String[] abbrevs = { "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne" }; // An array index int current; void setup() { size( 300, 400 ); pick(); } void pick() { current = int( random( 10 ) ); } void draw() { background( 80 ); fill( 255 ); textSize( 64 ); textAlign( CENTER ); text( abbrevs[current], width / 2, 150 ); if ( keyPressed && (key == ' ') ) { textSize( 36 ); text( elements[current], width / 2, 250 ); } } void keyPressed() { if( keyCode == RIGHT ) { pick(); } }