Hey there!
My goal is to build a working chat / textbox calculator which would solve most of the mathematical operations.
However, I don’t really know how would I go about coding it.
I am stuck literally at the beginning (finding operators and calculating it).
I don’t want to write million if statements only to check what is the operator and to calculate it.
e.g:
if operator == "+" then
print(num1 + num2)
elseif operator == "-" then
print(num1 - num2)
elseif operator == "/" then
print(num1 / num2)
-- etc...
end
I expect it to solve operations like these:
2 + 3
,
10 + 6 - 2
,
88 - 2 * 9
,
30 / 2 * 5.25 - 2
50 ^ 70 / 1.5
I just wrote some random ones, but you get the point right?
Adding, subtracting, multiplying, diving, exponentation, operating on floats.
I tried googling for the solution, I also tried to look at Developer Hub and Scripting Helpers but I couldn’t seem to get any help. That’s why I am writing this.
Just to be clear: I don’t want any ready-to-use scripts.
I just need some help with this, tips, and a possible explanation on how would I easily code it.
It’s a challange I always wanted to do.
(Sorry for my bad english, I am still learning. I might have mistook operations with equations )
Thanks, any help is really appreciated!