LOTUSSCRIPT LANGUAGE


Examples: Property Get/Set statements
' This example illustrates basic operations with a property.
' The counter is a property; it receives a starting value.
' Each time the property is used, it returns a value that is
' 1 greater than the previous value, until a new starting
' value is set. In this example, counter is set to 100.
' Then the property is used to print 101 and again
' to print 102.

' A variable to store values between uses of the property
Dim count As Integer

Property Get counter As Integer
  count% = count% + 1    ' Add 1 to the previous value.
  counter% = count%      ' Return the value.
End Property

Property Set counter As Integer
  count% = counter%      ' Assign the value to count.
End Property
counter% = 100

' Each time the property is used, it increments count
' by 1 and returns count's value, so this prints 101.
Print counter%

' Prints 102
Print counter%

See Also