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 6 - If/Else Statements \n ")
- print("These are useful in more complex programs. They provide basic logic to a program. \n ")
- print("if a == 1 then - If the variable \"a\" equals 1, then the program will print \"Hello\"")
- print("print(\"Hello\")")
- print("elseif a == 2 then - Otherwise, if \"a\" is equal to 2 then the program will print ")
- print("print(\"Goodbye\")")
- print("\"else\" - Otherwise the program will print \"Hello World\"")
- print("print(\"Hello World\")")
- print("end - Designates the end of the if statement \n ")
- term.restore()
Add Comment
Please, Sign In to add comment