Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Wont let me add or subtract?

Says error on line 2, Not sure what i did wrong.

function Add(A, B)
print(a - b)
return a + b
end

function Subtract(A, B)
print(a - b)
return a - b
end

Add(53, 42)
Subtract(21, 11)

2 answers

Read this, I cooked it up for you just now.

function Add(A, B) --Your function.
	-- Roblox is case sensitive so you have to use Capital A, and Capital B. Instead of a + b. SINCE you used Capital A & Capital B as variables when the funcion is called.
	print(A + B)
	return A + B
end

function Subtract(A, B)
	-- Roblox is case sensitive so you have to use Capital A, and Capital B. Instead of a - b. SINCE you used Capital A & Capital B as variables when the funcion is called.
	print(A - B)
	return A - B
end

Add(Variable1, Variable2)
Subtract(Variable1, Variable2)
Add(Subtract(53, 12), 12) -- Since your function uses return you could also do something like that :P.

All identifiers, properties, and keywords are case-sensitive. That means the capitalization counts.

a is not the same thing as A -- they are completely different variables!

This discussion is preserved as it was. New answers, comments, and votes are closed.