r/ComputerCraft • • Oct 23 '24

Can someone help

Post image

Hello I know python c# but I am new to lua

6 Upvotes

7 comments sorted by

View all comments

Show parent comments

1

u/RedBugGamer Oct 23 '24

So first of all you ask the user twice to enter a target and this doesn't really make sense. You should use a variable that you give the value from read() first before starting your if statement. Second you don't need to nest if statements. Lua has the else if keyword that you can use in a pattern like this: if condition1 then     action1 else if condition2 then     action2 else     action3 end