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:

Question also asked at the Processing forum:


2 thoughts on “Simon’s next own code: Calculator

  1. 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.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s