Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Declaring a struct is very similar to declaring a {{class}, except that the name is changed.

Code Block
borderStylesolid
titledeclaring a struct
borderStylesolid
struct Coordinate:
    def constructor(x as int, y as int):
        _x = x
        _y = y

    _x as int
    _y as int

c as Coordinate
print c._x, c._y
c = Coordinate(3, 5)
print c._x, c._y
No Format
bgColor#D8DDE9
titleOutput
borderStylesolid
titleOutput
0 0
3 5

Here you can see that the struct was instanced without being called, showing the how a struct is a value.

...