Page 139 - KEC Khaitan C5 Flipbook
P. 139

} else {

                             setText("resultLabel", "Wrong answer, try again.");

                     }

                 };

















                 Note: To perform it, add label, Text Input and button in design mode.




                        REVISIT



                      ▶ In Code.org’s App Lab, variables allow us to manage user input, perform calculations, and
                      control program behaviour dynamically.
                      ▶ In App Lab, operators and conditional statements help you perform calculations, compare
                      values, and make decisions in your program.

                      ▶ Conditional statements allow programs to make decisions based on conditions.
                      ▶ In App Lab, you can use Boolean operators (&&, ||, !) to make your program smarter.

                      ▶ In App Lab, we can create functional apps using variables and conditional logic.







                                                    HANDS-ON PROJECT



                 PROJECT NAME: Interactive Calculator

                 Objective:

                   Design and build an interactive calculator that can perform basic arithmetic operations
                   (addition, subtraction, multiplication, division).

                   Create a user-friendly interface with buttons for numbers, operators, and result display.

                   Implement  the logic  behind  the calculator using  event handling, variables, and
                   conditionals to process user inputs and display results.




                                                                          Working with Variables and Conditional Logic  137
   134   135   136   137   138   139   140   141   142   143   144