Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --This is part of a Computercraft Programming Teaching Program
- tSides = {"left","right","bottom","top","front","back"}
- for i = 1, #tSides do
- monitor = peripheral.wrap(tSides[i])
- if monitor then
- side = tSides[i]
- break
- end
- end
- --Prevents program termination
- os.pullEvent = os.pullEventRaw
- term.redirect(peripheral.wrap(side))
- -- Resets Screen
- function reset()
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- end
- reset()
- print("Section 7 - Loops \n ")
- print("These are also useful in more complex programs. They can provide logic to a program.")
- print("Remember to always put \"end\" as the last line to close the loop\n ")
- print("while a == 1 do - While the variable \"a\" is equal to 1, keep looping /n")
- print("for <start>, <end>, <interval> do - this is a more advanced loop.")
- print("for a = 1, 10 do - Interval is optional. It sets a local variable to the loop \"a\" as 1 and")
- print("stops looping when \"a\" is equal to 10 \n ")
- term.restore()
Add Comment
Please, Sign In to add comment