Hallo, I‘am a new member. Have no skills with the program.
I‘am looking for an simple example code for input numbers, calculate ( „+“ or other operations) and
Print the result.
How can I run a finished „program“ alone?
Thanks Bernd555

Hi @Bernd555 Here’s a program to add, subtract, multiply, and divide 2 numbers. Enter a number in the 2 input boxes and tap Calc. This is really simple and doesn’t come close to what Codea can do.

function setup()
parameter.text("Number1")
parameter.text("Number2")
parameter.action("Calc",calc)
end
function calc()
output.clear()
print(Number1.." + "..Number2.." = "..Number1+Number2)
print(Number1.." - "..Number2.." = "..Number1-Number2)
print(Number1.." x "..Number2.." = "..Number1*Number2)
print(Number1.." / "..Number2.." = "..Number1/Number2)
end

Here’s another example. Just enter the expression and press Calc. See the 2 examples for syntax.

function setup()
parameter.text("expression")
parameter.action("Calc",calc)
print("example 23.4*12.8")
print("example 45/9+34.6-6/2")
end
function calc()
loadstring("a="..expression)()
print(expression.." = "..a)
end

## Comments

Hi @Bernd555 Here’s a program to add, subtract, multiply, and divide 2 numbers. Enter a number in the 2 input boxes and tap Calc. This is really simple and doesn’t come close to what Codea can do.

Here’s another example. Just enter the expression and press Calc. See the 2 examples for syntax.

Hi dave1707 Thanks for your answer.