Skip to content Skip to sidebar Skip to footer

Which Type of Variable Can Hold Only One of Two Values: True or False?

The true or simulated variable, too known as boolean, is a blazon of variable that only has two possible values, true or false. These variables enable you to make decisions, and thus accept a better control over your flow.

To exemplify how y'all can work with true or false variables, nosotros are going to create an automation that asks the user for his proper noun and gender, and displays the results in another window.

  1. Create a new project.
  2. Create 2 string variables, strName and strGender. The first is going to exist used to store the proper noun of the user, and the second to store the user's gender.
  3. Create a boolean variable, boolMale. This variable is going to be used to verify if the user is a male.

  1. Add an Input Dialog activeness to the Designer panel and connect information technology to the Start node.
  2. In the Backdrop panel, in the Characterization field type "What is your name?".
  3. Add a title and, in the Result field, add the strName variable.
  4. Add another Input Dialog action and connect information technology to the previous 1.
  5. In the Backdrop panel, in the Label field, blazon "What is your gender?".
  6. Add a title and, in the Outcome field, add the strGender variable.
  7. Add together a Flow Conclusion action to the Designer panel, and connect it to the second Input Dialog.
  8. In the Properties panel, in the Status field, type strGender = "Male" or strGender = "male person". This activeness checks if the user is a male person or female.
  9. Add ii Assign activities.
  10. Connect one to the True branch of the Menstruation Decision activity.
  11. In the Properties panel, in the To field enter the boolMale variable.
  12. In the Value field, type Truthful. This assigns the True value to the boolMale variable when the strGender = "Male person" or strGender = "male" condition is met.
  13. Connect the second Assign activeness to the Imitation branch of the Menstruation Decision.
  14. In the Properties panel, in the To field, enter the boolMale variable.
  15. In the Value field, type False. This assigns the Simulated value to the boolMale variable when the strGender = "Male" or strGender = "male" condition is not met.
  16. Add a new Flow Determination and connect the previously added Assign activities to it.
  17. In the Properties panel, in the Condition field, type boolMale = Truthful.
  18. Add together a Message Box activity and connect it to the True co-operative of the Flow Decision.
  19. In the Properties panel, in the Text field, type strName + " is a " + strGender + ".". This message displays the name of the user and its gender, if boolMale is true.
  20. Add another Message Box activity and connect information technology to the False co-operative of the Menstruation Decision.
  21. In the Properties panel, in the Text field, type strName + " is a " + strGender + ".". This message displays the name of the user and its gender, if boolMale is simulated. The final project should wait like in the following screenshot.

  1. Press F5. The automation is executed. Note that the final Message Box displays the bulletin equally expected.

Click here to download the example.

Updated 4 years agone


See Also

reedhiself.blogspot.com

Source: https://docs.uipath.com/studio/v2018.1/docs/true-or-false-variables

Post a Comment for "Which Type of Variable Can Hold Only One of Two Values: True or False?"