This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
ballpro's profile picture

Program Not Working

Started by ballpro, 31 January 2014 - 02:56 PM
ballpro #1
Posted 31 January 2014 - 03:56 PM
Hi I am having a lot of trouble with this one in particular program, I have been trying for over a week to get it to work but I still cannot get it. here is the code

function N()
term.clear()
print("Installation Canceled")
sleep(5)
term.clear()
term.setCursorPos(1, 1)
print("BallOS v1,4")
term.setCursorPos(1, 2)
end

function Y()
term.clear()
textutils.slowPrint("Installing..")
sleep(5)
term.clear()
term.setCursorPos(1, 1)
textutils.slowPrint("Please Wait..")
sleep(5)
term.clear()
term.setCursorPos(1, 2)
read()
end
print("Would You Like To Initiate Installation?)
term.setCursorPos(5, 5)
print("Y Or N")
term.setCursorPos(5, 7)
read()

if input == Y then
Y()
else
N()
end
————————————————————————————————————-




With that code no matter what I do even if I type Y it does the N() function
Lyqyd #2
Posted 31 January 2014 - 04:55 PM
Change your comparison to check against the string "Y":


if input == "Y" then
mrpoopy345 #3
Posted 31 January 2014 - 04:56 PM
Your checking if the input is equal to a variable named Y
Use:

if input == "y" then
Edit: Ninja'd
Edited on 31 January 2014 - 03:56 PM