• Godot HelpProgramming
  • Can I use comparisons like "==" on strings? , if not how could I check wha a string says something?

Super simple question. On the Docs it just says that == is a comparison. I'm pretty sure in other languages you can't use == with strings but I'm not sure why? I have a variable that's value ( which is a string) is constantly changing. If I can't use == what else could I use to check what the variable says?

You can use == on strings in GDScript. I guess in other languages it compares whether the references of the strings are the same so it won't work but it will in GDScript.

Using == has worked for string comparison for me as well. You can also use begins_with, ends_with, and find if you are looking for a part of a string in another string, but if the strings are the same, then == should work fine :smile:

2 years later