@@ -5,7 +5,6 @@ <h2>Comments</h2>
5
5
6
6
< h2 > Strings</ h2 >
7
7
< pre > < code > "foo \"bar\" baz"
8
- 'foo \'bar\' baz'
9
8
@"Verbatim strings"
10
9
"""Alternate "verbatim" strings"""
11
10
</ code > </ pre >
@@ -58,32 +57,32 @@ <h2>Numbers</h2>
58
57
</ code > </ pre >
59
58
60
59
< h2 > Full example</ h2 >
61
- < pre > < code > // The declaration creates a constructor that takes two values, name and age.
60
+ < pre > < code > // The declaration creates a constructor that takes two values, name and age.
62
61
type Person(name:string, age:int) =
63
- // A Person object's age can be changed. The mutable keyword in the
64
- // declaration makes that possible.
62
+ // A Person object's age can be changed. The mutable keyword in the
63
+ // declaration makes that possible.
65
64
let mutable internalAge = age
66
65
67
- // Declare a second constructor that takes only one argument, a name.
68
- // This constructor calls the constructor that requires two arguments,
69
- // sending 0 as the value for age.
66
+ // Declare a second constructor that takes only one argument, a name.
67
+ // This constructor calls the constructor that requires two arguments,
68
+ // sending 0 as the value for age.
70
69
new(name:string) = Person(name, 0)
71
70
72
- // A read-only property.
71
+ // A read-only property.
73
72
member this.Name = name
74
- // A read/write property.
73
+ // A read/write property.
75
74
member this.Age
76
75
with get() = internalAge
77
76
and set(value) = internalAge <- value
78
77
79
- // Instance methods.
80
- // Increment the person's age.
78
+ // Instance methods.
79
+ // Increment the person's age.
81
80
member this.HasABirthday () = internalAge <- internalAge + 1
82
81
83
- // Check current age against some threshold.
82
+ // Check current age against some threshold.
84
83
member this.IsOfAge targetAge = internalAge >= targetAge
85
84
86
- // Display the person's name and age.
87
- override this.ToString () =
85
+ // Display the person's name and age.
86
+ override this.ToString () =
88
87
"Name: " + name + "\n" + "Age: " + (string)internalAge
89
- </ code > </ pre >
88
+ </ code > </ pre >
0 commit comments