Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I made a Variable for my favorite food, But it isn't coming up right, What do I have to do?

Asked by 8 years ago

I'm trying to test out "Variables" and I typed this...

print (MyFavoriteFood) = Tacos

What am I doing wrong?

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

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.

0
Thank you! zombiesquadleader123 0 — 8y
0
Anytime. ScriptGuider 5640 — 8y
Ad

Answer this question