Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 150 - 2615_KEC
P. 150

    if (!isRaining) {

                          setText("outputLabel", "Go outside, it's clear!");

                      } else {

                          setText("outputLabel", "Stay dry!");
                      }

                      });

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

                                INPUT-PROCESS-OUTPUT (IPO) MODEL IN PROJECTS

                      The IPO model helps structure programs by breaking them into three main parts:

                         Input: Collecting user data (e.g., typing a name or clicking a button).

                         Process: Performing calculations or logic based on the input.

                         Output: Displaying results to the user.

                      BUILDING APPS WITH VARIABLES AND CONDITIONS

                      In App Lab, we can create functional apps using variables and conditional logic. Some
                      project ideas include:

                         Quiz App: Store user answers in variables and check if they are correct.

                         Simple Game: Keep track of a player’s score and decide if they win or lose.

                         Weather  App: Take user input  (temperature) and display a message  based  on
                        conditions.

                      Example: Quiz App Code

                      onEvent("button1", "click", function() {

                          var answer = getText("inputBox");

                          if (answer == "Paris") {

                                  setText("resultLabel", "Correct!");

                      148   Premium Edition-V

| 145 146 147 148 149 150 151 152 153 154 155 |