P5.js code for creating a calculator tip app confused

so would button.mousePressed(calculation); being moved to function calculation() be an alternative or moving everything to draw()?