Greetings fellow programmers! I need some feedback & support on the code that I typed last night. I’m learning Lua (Started learning 1 month ago) and I learned about the If else statements & Input. I typed out the code in Replit.
CODE:
var = "Cookies"
print (var.. " are very yummy!!")
--------------------------------------------------------------------
print ("----------------------")
--------------------------------------------------------------------
name = "MachineCoder"
if name == "MachineCoder"
then
print ("MachineCoder activated!")
end
--------------------------------------------------------------------
print ("----------------------")
--------------------------------------------------------------------
cheez = "cheese"
if cheez == "cheese"
then print(" Me lykes cheese! Yum Yum. " )
end
--------------------------------------------------------------------
print ("----------------------")
--------------------------------------------------------------------
numb = 5
if numb == 5 -- Change this value to any number except 5 to get the flase print statement.
then print("The number is 5")
else
print ("The number is not 5")
end
--------------------------------------------------------------------
print ("----------------------")
--------------------------------------------------------------------
LuaU = "Lua"
if LuaU == "Lua"
then print(LuaU.. " is life! ")
else
print("This is not Lua dude! This is Ruby.")
end
--------------------------------------------------------------------
print ("----------------------")
--------------------------------------------------------------------
io.write("What's your name?")
name = io.read()
if name == "MachineCoder"
then print ("Hey there!")
else
print(" I think I don't know you. Have a great day!")
end
--------------------------------------------------------------------
print ("----------------------")
--------------------------------------------------------------------
--[[io.write("Your username?")
username = io.read()
if username == "Coder"
then print("Hello CODER!")
else
print(" I think I don't know you. Have a great day!")
end]]
--------------------------------------------------------------------
print ("----------------------")
--------------------------------------------------------------------
And I don’t know why this line of code isn’t working in Roblox Studio:
io.write("What's your name?")
name = io.read()
if name == "MachineCoder"
then print ("Hey there!")
else
print(" I think I don't know you. Have a great day!")
end
Any solution?
Waiting for your feedback and support @Programmers
- Harmony