2 posts
Posted 25 April 2015 - 10:23 PM
Hi i have a problem with my program. The error is already described in the topic title. Here is the link to the code :
http://pastebin.com/7HNVhmgBI searched for more than an hour but the only thing I could find was the same error with no answer or different errors. Neither of them could help me so i hope you can do so.
The program itself should make something like a mountain flat. If there is any question regarding the program don't hesitate to ask me about it. In general the program is running but the print-function isn't working which would not be necessary but really great.
Thanks for your answers
Yeti
957 posts
Location
Web Development
Posted 26 April 2015 - 01:18 AM
Well, this is line 57:
print . . b - a . . " fuel are remaining "
You don't need to do any math, just use 'turtle.getFuelLevel()'
print( turtle.getFuelLevel() .. " fuel remaining" )
You can do it without the parenthesizes for print, but its better to use them.
( turtle.getFuelLevel() has to have them )
7083 posts
Location
Tasmania (AU)
Posted 26 April 2015 - 01:23 AM
Note that this isn't eg BASIC - if you want to pass more than a single argument to a function, the brackets are required. Many, if not most, coders use the brackets under all circumstances, for the sake of consistency.
570 posts
Posted 26 April 2015 - 01:24 AM
You can do it without the parenthesizes for print, but its better to use them.
As soon as the string is not constant, you can't omit the parentheses. So you would have to use them in this case regardless.
2 posts
Posted 26 April 2015 - 07:15 PM
Well, this is line 57:
print . . b - a . . " fuel are remaining "
You don't need to do any math, just use 'turtle.getFuelLevel()'
print( turtle.getFuelLevel() .. " fuel remaining" )
You can do it without the parenthesizes for print, but its better to use them.
( turtle.getFuelLevel() has to have them )
But with " turtle.getFuelLevel() " the program won't say me how much fuel i still need to refill to run the hole program. this is the task of the line 57.
You can do it without the parenthesizes for print, but its better to use them.
As soon as the string is not constant, you can't omit the parentheses. So you would have to use them in this case regardless.
I tried the program with parentheses/ brackets but there is still the same error or I placed them in the wrong place
1140 posts
Location
Kaunas, Lithuania
Posted 26 April 2015 - 07:45 PM
I tried the program with parentheses/ brackets but there is still the same error or I placed them in the wrong place
Where did you put them?