This example demonstrates how a simple calculator program can be built using the JPX programming language.
The project shows how to combine multiple JPX features such as:
- User input with the
Scannermodule - Arithmetic operations
- Conditional logic
- Functions
- Output using
Print
The calculator program supports basic arithmetic operations:
- Addition
- Subtraction
- Multiplication
- Division
Users can input numbers and select an operation, and the program will display the result.
This example uses several built-in JPX modules.
Used to receive input from the user.
Example usage:
[Scanner];
The module allows programs to read text input from the terminal.
The calculator example demonstrates the following JPX syntax concepts:
Storing numbers entered by the user.
Performing mathematical calculations.
Organizing calculation logic into reusable blocks.
Handling operation selection such as addition or subtraction.
- Install JPX from the official repository.
- Download the example project.
- Run the calculator script using the JPX runtime.
Example command:
jpx run calculator.jpx
This example is designed for beginners who want to understand:
- Basic JPX syntax
- Working with input
- Performing calculations
- Structuring simple programs
JPX official repository:
This example project follows the same license as the JPX language project.