A Short Background Story
I have been using Kodular for more than 3 years now. It has helped me a lot to clear my concepts regarding programming. It has also motivated me to learn java. Recently I started learning java and to implement what I learn in java I started making simple extensions so I could practice what I learn and don’t get bored.Special thanks to @Atom_Developer for helping me out whenever I am struck at something and being the motivation for me and many others.And also to this amazing platform
I have made this pretty simple but powerful extension that can parse a mathematical expression and instantly return result to you.The extension is made using a powerful library called mXParser. But note that this extension is already provided by taifun here. I just made it for learning purpose and nothing more.
Example of expression :
You can find area of sphere by using
4 * pi * r^2
Where pi is a constant already available in the library and r is the radius that you get as an input from user.
Images of Blocks
- Parse Block
This is the main block of extension. This will be used to parse expressions and get result instantly. Moreover all other blocks are also meant to be used with this block to get result.
- Simple Formula Blocks
These block return an expression with your provided parameters. Use these blocks with parse block to get result.
- Constant Blocks
The block GetConstants returns a list of constants that are in the library. The second blocks provides detail of all the constants that are returned from GetConstants block.
- Error Occurred Block
This event block is triggered when there is an error in your expression. You can find error details through error parameter of this block
Download AIX File
com.dreamers.ExpressionParser.aix (630.2 KB)
How to make expression for a formula
I have provided some basic formula blocks to help you understand the working of extension. You can easily create expression for any formula like I have shown above.Lets have another example:
You can find Square root of any number by using:
here sqrt represents square root and number can be any number like 1,2,3,4etc.
You can find more details on mXparser.
The uses of this extension are unlimited. You can use logic gates like && , || , ! etc. You can make comparisons like =, <, > etc. You have a large number of constants that you can get by using a single block. You can find value of those constants by parsing them using the parse block. You can use cos, tan, sin etc. You can easily make a calculator by using this extension and much more.
Hope you guys enjoy it and find this extension useful. Make sure to check it and let me know what you think. Happy Koding