Comparing structure variables with one command
Posted: Tue Oct 08, 2024 10:15 am
Heya,
I asked ChatGPT and he gave me this code:
But I executed it, and it says that the structures are different.
Is there an easy way of doing this?
Thanks!
I asked ChatGPT and he gave me this code:
Code: Select all
Structure Person
Name.s
Age.i
Height.f
EndStructure
Dim Person1.Person(1)
Dim Person2.Person(1)
Person1(0)\Name = "John"
Person1(0)\Age = 25
Person1(0)\Height = 1.80
Person2(0)\Name = "John"
Person2(0)\Age = 25
Person2(0)\Height = 1.80
; Comparing the memory size of the two structures
If CompareMemory(@Person1(0), @Person2(0), SizeOf(Person))
Debug "Structures are equal"
Else
Debug "Structures are different"
EndIf
Is there an easy way of doing this?
Thanks!