Explorar el Código

Mention that `Dictionary.hash()` can be used for equality comparisons

See #27615.
Hugo Locurcio hace 5 años
padre
commit
ecd572073c
Se han modificado 1 ficheros con 7 adiciones y 1 borrados
  1. 7 1
      doc/classes/Dictionary.xml

+ 7 - 1
doc/classes/Dictionary.xml

@@ -83,7 +83,13 @@
 			<return type="int">
 			</return>
 			<description>
-				Returns a hashed integer value representing the dictionary contents.
+				Returns a hashed integer value representing the dictionary contents. This can be used to compare dictionaries by value:
+				[codeblock]
+				var dict1 = {0: 10}
+				var dict2 = {0: 10}
+				# The line below prints `true`, whereas it would have printed `false` if both variables were compared directly.
+				print(dict1.hash() == dict2.hash())
+				[/codeblock]
 			</description>
 		</method>
 		<method name="keys">