Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sleep(x) -- Turtle waits for x seconds
- break --should stop the program??
- local --not sure. I think it sets a variable status
- while true do --program will run as long as condition is met.. true can be a condition like x>16
- while not (command) do --will run command, but if unable to will run to do command. Eg while command can run it == true but if unable then command ==false and so the following condition is ran
- for i=1,16 do -- runs program 1 thru 16 cycles. 1, 10, 2 will cycle 1-10 but only every +2 cycle so 1 3 5 7 9
- if (condition) then --activates if the condition is met
- else --if the if condition is not met then do the following instead
- elseif -- not sure. May be the same as writing an if condition after an else
- break --stios the loop and continues program
- repeat --requires further understanding
- term.write("Who's that Pokemon?") --asks question and awaits a response
- read() --reads response. x = read() will set x to the response
- function name(x) --creates a mini program that can just be inserted in other places. Create all functions first. X is a variable that can be changed when using the function eg name(5) will have x=5 inside the function. Knowing as passing a variable
- return variable --similar to a break. Stops the function and sends variable info to continue program. Best used in a "while not condition do" loop
- --arrays
- local pokemon = {"name1", "name2", "name3"}
- --creates a list under the program pokemon[]. Eg. pokemon[2] will pull up name2
- --for loop + print to generate list
- for p=1,3 do
- print (pokemon[p])
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement