This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Jakeness56's profile picture

Errors with a loop/code

Started by Jakeness56, 27 July 2017 - 05:37 AM
Jakeness56 #1
Posted 27 July 2017 - 07:37 AM
Hello, so I have been having this issue with my code, I'm trying to make a redstone clock as an option in this lighting system but it keeps throwing me this error please help!

https://gyazo.com/6103228e59e5e307e8d671a4ff4b8a4b

https://gyazo.com/3da6f150edb56084556af206f3a7d37c
Bomb Bloke #2
Posted 27 July 2017 - 10:32 AM
It would be easier to read your code if you pastebin'd it, but it looks like you're using "else if" where you meant to use "elseif".

For example, notice how this:

if <condition1> then
	-- do stuff
else
	if <condition2> then
		-- do other stuff
	else
		if <condition3> then
			-- do something different
		end
	end
end

… requires more end statements than this:

if <condition1> then
	-- do stuff
elseif <condition2> then
	-- do other stuff
elseif <condition3> then
	-- do something different
end

http://lua-users.org/wiki/ControlStructureTutorial