 
                
                2 posts
                
             
            
                Posted 10 January 2013 - 06:03 AM
                So,i created this program here  :
turtle.refuel(2)
if turtle.getItemCount() > 1 then
i = 1
turtle.select(1)
turtle.placeDown()
turtle.forward()
turtle.placeDown()
turtle.back()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
i = i+1
until i == 10
else
print("DONE")
end
And i get this bloody error :
bios:338: [string "bridge2"]:14: 'end' expected (to close if at line 3)
Guess you realize what this program is meant to be,PM me if there are any problems.
 
         
        
        
            
            
                
                     
                
                323 posts
                
                    
                        Location
                        Boston, MA
                    
                
             
            
                Posted 10 January 2013 - 06:05 AM
                You need to put an end before the else statement… :D/>
                
             
         
        
        
            
            
                
                     
                
                436 posts
                
             
            
                Posted 10 January 2013 - 06:15 AM
                No. He needs to have that else above the until, or have a repeat somewhere above all that, and probably some combination of both.
turtle.refuel(2)
turtle.select(1)
repeat
   if turtle.getItemCount(num) > 1 then -- BTW, you need a number for that function, I think.
      turtle.placeDown()
      turtle.forward()
      turtle.placeDown()
      turtle.back()
      turtle.turnLeft()
      turtle.forward()
      turtle.turnRight()
      i = i+1
   else
      print("Done")
      break
   end
until i == 10
That should be close to what you are trying to do.
 
         
        
        
            
            
                
                     
                
                2005 posts
                
             
            
                Posted 10 January 2013 - 09:39 AM
                I'm not sure what the program is supposed to do.  I mean, it looks like it builds a squiggly bridge, but that's hardly an obvious enough task to say "Guess you realize what this program is meant to be".
                
             
         
        
        
            
            
                
                     
                
                2 posts
                
             
            
                Posted 11 January 2013 - 01:56 AM
                Got it.I used OmegaVests code,except i added "i = 1" before the "repeat".Now it works fine :D/> . Thanks
                
             
         
        
        
            
            
                
                     
                
                7508 posts
                
                    
                        Location
                        Australia
                    
                
             
            
                Posted 11 January 2013 - 01:58 AM
                other option is to use a for loop… this creates the i variable and increments it for you…
for i = 1, 10 do
   if turtle.getItemCount(num) > 1 then -- BTW, you need a number for that function, I think.
	  turtle.placeDown()
	  turtle.forward()
	  turtle.placeDown()
	  turtle.back()
	  turtle.turnLeft()
	  turtle.forward()
	  turtle.turnRight()
   else
	  print("Done")
	  break
   end
end
Edited on 11 January 2013 - 12:59 AM
                
             
         
        
        
            
            
                
                     
                
                2005 posts
                
             
            
                Posted 11 January 2013 - 05:11 AM
                Aha, a non-squiggly bridge.