ID:665448
 
(See the best response by Albro1.)
Code:
proc
Calculator (var/X=0, var/Y=0, var/Z=0)
switch(input("What type of Calculation")in list("Adding","Minus","Times","Divided"))
if("Adding")
X=input("Input A Number","Number")
Y=input("Input A Number","Number")
Z="[X]"+"[Y]"
usr<< Z


Problem description:
I am trying to add X and Y to = Z but my input detects it as a text not a number i was wounder how am i suppose make it so it outputs the two numbers add not just in a text string

Side Note
omit me not doing the other if statements
Best response
Use the as num extension to input().

X = input("X?", "X + Y = Z") as num
Y = input("Y?", "X + Y = Z") as num
Z = X + Y
src << Z


Don't use usr in procs. I also don't know why you are using Z as an argument in the proc, as Z is what you are looking for in the calculation, not as a given value. Also, you do not need to declare them with var/ in a proc's arguments. This will simply do:
proc/Calculator()
var X, Y = 0
switch(input("What type of calculation?") in list("Addition", "Subtraction", "Multiplication", "Division"))
if("Addition")
X = input("X?", "X + Y = Z") as num
Y = input("Y?", "X + Y = Z") as num
src << X + Y


You are doing way too much for what is needed. I have a feeling you don't quite understand named arguments yet. Keep at it, though.
Thanks a lot i am still learning in the code aspect of byond and i was using the Z because it makes more sense to me whether it does to you is your style.

Still thanks for the as num i knew it was something like.
It isn't a matter of style; putting the Z there when you won't be passing an argument to it is pointless.
Listen i understand the point your trying to understand but i believe that Z is need because when i put more complex calculations on it the z will be needed but i might have to add even more vars like v w i will use it not yet though