Simon’s next own code: Calculator

Since he wrote his first own code last week, Simon has attempted to write a couple more. This morning he came up with a code for a calculator in the p5 web editor (JavaScript). He managed to create the design looking exactly like his favourite Solve calculator app (on the iPad) and the buttons seemed clickable, but there must be some kind of bug in his code as nothing appears in the window. We pasted the link to entire code below — should anyone know what the problem is, please let us know in the comments!

The design:

The bug:

The code:

https://alpha.editor.p5js.org/simontiger/sketches/SJOev0Pnx

Question also asked at the Processing forum:

https://forum.processing.org/two/discussion/21673/bug-in-calculator-program-in-p5-js

2 Replies to “Simon’s next own code: Calculator”

  1. codeinfig's avatar

    which line is supposed to define what the button does when clicked?

    i tried to add one, but this syntax is unfamiliar. i used to create buttons in html, then use javascript to style and respond to presses. thats probably oldschool now. but i can only find code for creating the button– not for getting it to do something, hence my question.

    Like

Leave a reply to codeinfig Cancel reply