Skip to main content

ValueCalculator

Encapsulates stateful computation to avoid global variables.

Attributes

  • v: int = 10
    • initial_value

Constructors

  • Initializes the ValueCalculator with an optional initial value.

  • Parameters

    • initial_value: int
      • The starting value for the calculator.

Methods

def get_value(x: integer) - > integer
  • Simulate a long-running computation.

  • Parameters

    • x: integer
      • The integer input for the computation.
  • Return Value: integer

    • The computed value after multiplication and state update.