I'm trying to test out "Variables" and I typed this...
print (MyFavoriteFood) = Tacos
What am I doing wrong?
I'm trying to test out "Variables" and I typed this...
print (MyFavoriteFood) = Tacos
What am I doing wrong?
Variables
Variables are created in their own initial statements - they cannot be created within another statement. For example, if you wanted to make a variable for the text Tacos, having the variable name be MyFavoriteFood, you must format it like this:
-- Variable created in it's own statement
MyFavoriteFood = "Tacos"
-- Now printing the variable as a seperate instruction
print(MyFavoriteFood) -- Prints the variable value (Tacos)
Also notice that there are quotation marks around Tacos. This is called a string value, and is vital to understand before you move on to anything else in programming. Hope this helped, just let me know if you have any questions.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Thank you!
Anytime.