How to call a function whenever the two buttons are clicked? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to call a function whenever the two buttons are clicked?

How to call a function whenever the two buttons are clicked? I have a short code where the two boolean initializations are false. And whenever the first button is click, it sets the boolean to true. And after that if the second button is click, it sets the another boolean to true. If the two booleans are both set to true (or if the two buttons are clicked), it should call a function. The example is in the code. 🥺🥺 I failed my attempt. https://code.sololearn.com/W3yrwZxH7A0o/?ref=app

23rd Dec 2021, 2:07 PM
Rean Glenn Roquero
Rean Glenn Roquero - avatar
2 Answers
+ 7
All u have to do is ... Add a function called check and inside this write those if & else statement And call check function on both click event Here is the correct code https://code.sololearn.com/WHK3ffV9Ejo4/?ref=app
23rd Dec 2021, 2:52 PM
Pariket Thakur
Pariket Thakur - avatar
+ 1
Thank you so much. That helps me a lot.
23rd Dec 2021, 10:58 PM
Rean Glenn Roquero
Rean Glenn Roquero - avatar