[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Can I use the loops as..
- From: kingsley young <kingsleyyoung27@...>
- Date: Wed, 2 Nov 2011 12:56:38 -0700
which loop would be best to use when trying to get the user to input a word and can you treat it as a if statement. like i did here.
i tried ti do a repeat until loop didnt work in the way i wanted to work. Now in the example im trying the for loop which they said is the best one to use but it wont run
this is the error i get for the, for newReply1=="beer" do line
>lua -e "io.stdout:setvbuf 'no'" "lovebot.lua"
lua: lovebot.lua:22: '=' or 'in' expected near '=='
>Exit code: 1
reply1 = io.read(); -- reply1 should only equal yes or no
if reply1=="no" then
io.write("Oh good what would you like to drink\n white rum $7\n red wine $10\n gray goose $12 \n beer $2");
elseif reply1=="yes" then
io.write("come on girl you know you want to have a good time to night");
end
reply1 = "no", "yes";
newReply1 = io.read();
for newReply1=="beer" do
io.write("SO which drink would you like: ", newReply1, "\n" );
io.write("hite rum $7\n red wine $10\n gray goose $12 \n beer $2\n");
end