1 namespace demo;
2
3 class Person scope:...
4
5 field name : str #:...
6 The name of the person.
7 field height : double #:...
8 Height of person in meters.
9 field weight : double #:...
10 Weight of person in kilograms.
11
12 lifecycle params:...
13 var name : str #:...
14 The name of the person.
15 var height -> height;
16 var weight -> weight;
17 scope:...
18 self.nameIs(name)
19
20 method bodyMassIndex : double #:...
21 Compute the BMI for this person.
22 scope:...
23 height = self.height()
24 return self.weight() / (height * height)
25