#hey guys I'm new to scripting and i need help

8 messages · Page 1 of 1 (latest)

void willow
#

I'm new to scripting and my simple script won't work

lapis ivy
#
print(1)
print("4")
print(true)
if 1+1 == 2 then
  print(true)
end```

when you have "if then" functions you have to have two equal signs (==) when doing true or false, and i would also add a space in between the 1 and the equal sign
#

sorry if that didnt make much sense

void willow
#

no that was perfect thank you so much

jagged ingot
# void willow no that was perfect thank you so much

For more context, = is what we call an operator. Operators in code perform pre-defined operations. = is the assignment operator, it has the power to change the value of a property, a variable, and birth a new variable. The reason your script failed is because the computer understood your action as "assign 1+1 to 2", not "is the result of 1+1 equal to 2?". Another operator exists for asking that question, and that operator is known as the "equality" operator—one of many relational operators. As hayden said, that operator is ==

void willow
#

so == is the right one

jagged ingot
#

For making a comparison of equality, yes