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

Error- help me

Started by imcr4bby, 29 November 2012 - 10:24 AM
imcr4bby #1
Posted 29 November 2012 - 11:24 AM
i have been coding my turtle to dig out some columns for a project i am working on but when i save the doe and exit this error comes up… bios:338: [string "receive"] :19: '<eof>' expected can somebody tell em a simple way to fix this problem. and line 19 is "end"

kind regards
james
OmegaVest #2
Posted 29 November 2012 - 11:25 AM
The problem is you have too many ends. If you post your code, we can help you pinpoint where.

But, it usually comes from a misunderstanding of an if block. Occasionally we all add an extra end, but that's usually the case.
imcr4bby #3
Posted 29 November 2012 - 11:58 AM
sue thing the code is

rednet.open("right")
s, m = rednet.receive()
if m == "home" then
for i = 1, 38 do
   turtle.up()
   end
end
if m == "dig" then
for i = 1, 19 do
   turtle.digDown()
   turtle.down()
   turtle.digDown()
   turtle.down()
   end
end
if m == "back" then
   turtle.back()
   end
end()
if m == "left" then
   turtle.left()
   turtle.forward()
   turtle.right()
   end
end
if m == "right" then
   turtle.right()
   turtle.forward()
   turtle.left()
   end
end
if m == "forward" then
   turtle.forward()
   end
rednet.close("right")
Orwell #4
Posted 29 November 2012 - 12:02 PM
You've got lots of ends too many. For every 'if' block, change this:

if m == "right" then
   turtle.right()
   turtle.forward()
   turtle.left()
   end
end
To:

if m == "right" then
   turtle.right()
   turtle.forward()
   turtle.left()
end
You'd also want to look into the 'ifelse' statements.

Edit: also, you've got a typo (I think) here:

if m == "back" then
   turtle.back()
   end
end()
remove the parentheses:

if m == "back" then
   turtle.back()
end
KaoS #5
Posted 29 November 2012 - 12:16 PM
Edit: also, you've got a typo (I think) here:


You'd also want to look into the 'ifelse' statements.

lol you too :D/> 'elseif'
imcr4bby #6
Posted 29 November 2012 - 12:20 PM
okay i have done that and now i get this error bios:338: [string "receiver"] 30: 'end' expected (to close 'if' at line 7)

rednet.open("right")
s, m = rednet.receive()
if m == "home" then
for i = 1, 38 do
   turtle.up()
end
if m == "dig" then
for i = 1, 19 do
   turtle.digDown()
   turtle.down()
   turtle.digDown()
   turtle.down()
end
if m == "back" then
   turtle.back()
end
if m == "left" then
   turtle.left()
   turtle.forward()
   turtle.right()
end
if m == "right" then
   turtle.right()
   turtle.forward()
   turtle.left()
end
if m == "forward" then
   turtle.forward()
end
rednet.close("right")
KaoS #7
Posted 29 November 2012 - 12:23 PM
you just need to end your for loop, add another end before line 13
imcr4bby #8
Posted 29 November 2012 - 12:32 PM
great thanks guys i know its simple but im just getting into these things (i started about 3 hours ago) its working now
KaoS #9
Posted 29 November 2012 - 12:35 PM
haha. Orwell did most of the help here. you may want to consider giving him a +1, I don't know what the general belief is but I think that's reasonable
Tiin57 #10
Posted 29 November 2012 - 01:13 PM
great thanks guys i know its simple but im just getting into these things (i started about 3 hours ago) its working now
I realize that I didn't help at all, but that's why we're here, is to help beginners. I started programming just a few months ago. Now I know Java, C, C#, Objective-C, Lua, and am working on C++. You'll get there a lot faster than you think. :P/>
Orwell #11
Posted 29 November 2012 - 02:12 PM
Edit: also, you've got a typo (I think) here:


You'd also want to look into the 'ifelse' statements.

lol you too :D/> 'elseif'
Oh my… Is it less shameful if I was typing on my phone? :rolleyes:/>
ChunLing #12
Posted 30 November 2012 - 10:12 AM
We all suffer bouts of transposition at times.
KaoS #13
Posted 30 November 2012 - 10:45 AM
UNFORGIVABLE!!! lol I'm just kidding, we all do it :)/> I make the most horrible typos thanks to my crap keyboard, I'm just fast at editing