even simpler, just indent your class body...
> type MyCell(n:int) =
- let mutable data = n + 1
...
pblasucci
2010-02-03 16:31:31
even simpler, just indent your class body...
> type MyCell(n:int) =
- let mutable data = n + 1
...
It looks like to:
> type MyCell(n:int) =
- let mutable data = n + 1
is not respecting the indentation. F# is whitespace sensitive by default, so you must keep any indentation. Try instead:
> type MyCell(n:int) =
- let mutable data = n + 1
- // etc.
(You can make F# non-whitespace sensitive by adding #light "off" at the top of the file, then you need to use extra keywords, as per danben's answer).
Print
and ToString
are methods, but Data
is a property, so for Data
the =
comes before the definitions of the get
and set
methods.this
to refer to the class whose members are being defined, F# lets you choose an identifier on a member-by-member basis. x
is used in many examples, but the choice is arbitrary.