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

What's wrong with my code?

Started by klakkid, 07 June 2012 - 10:10 PM
klakkid #1
Posted 08 June 2012 - 12:10 AM
My mining turtle doesn't take this code. Can someone tell me what's wrong with it?


x = 0
while turtle.detect() do
turtle.dig()
turtle.digUp()
turtle.forward()
x = x+1
end
print "This tunnel is"...x..."metres long."

I want the turtle to create a 1x2 tunnel through a hill, mountain, wall, etc, then return a message stating how many blocks long the tunnel is. Can anyone help?
klakkid #2
Posted 08 June 2012 - 12:12 AM
Ah ha!
I fixed my script, terribly sorry.
I needed to remove the ellipses.
Bossman201 #3
Posted 08 June 2012 - 01:57 AM
Yes, string concatenation is done with only 2 periods

print("This tunnel is " .. x .. " metres long.")