- 12 Mar 2021
- 1 Minute to read
- Print
- DarkLight
Building a Simple Calculator
- Updated on 12 Mar 2021
- 1 Minute to read
- Print
- DarkLight
Overview
Example Lab Details | |
Version | 6.9.2 |
Root Folder | Example Lab - Calculator Example |
Modules | None |
Dependencies | None |
This Example Lab Project demonstrates how to build a simple calculator capable of multiplication, division, addition, and subtraction.
Explanation
This Example Lab project operates by using a form to gather the necessary user input, the "Evaluate Dynamic Expressions" step, and a form for displaying results. The first form, which gathers the user input for the calculator, requires the input of two numbers and the operation that is to be performed. The form then outputs this data to be used by the "Evaluate Dynamic Expressions" step. However, the "Evaluate Dynamic Expressions" step requires that the input be a single string. To accomplish this, the input type needs to be set to "merge plain text". This allows the three outputs from the form to be combined into a single input for the "Evaluate Dynamic Expressions" step. Once the step has run completely it will output the result of the calculation. This result as well as the original calculator input is then displayed in the last form for the user to review before closing the form and ending the flow.