added animal class
This commit is contained in:
parent
e2b1af59b4
commit
e9b3337ae4
3 changed files with 26 additions and 0 deletions
26
sm-test-files/animals-example/animal.sm
Normal file
26
sm-test-files/animals-example/animal.sm
Normal file
|
@ -0,0 +1,26 @@
|
|||
&& ++name declares a class
|
||||
&& '++name declares an abstract class
|
||||
&& all of that is, of course, a statement so ¡!
|
||||
|
||||
¡'++animal
|
||||
&& +}}type{{ declares a property of a class
|
||||
&& "+}}type{{ declares a static property of a class
|
||||
|
||||
¡"+}}string{{ name!;
|
||||
¡+}}string{{ speed!;
|
||||
|
||||
&& ### declares the constructor
|
||||
¡### /}}string{{ name\ /speed\ |
|
||||
¡<=/"Created animal named " + name\!;
|
||||
|
||||
&& +var refers to a property, like this. in other languages
|
||||
&& you can only assign values to static variables once in this language
|
||||
¡+name < name!;
|
||||
¡+speed < speed!;
|
||||
!
|
||||
|
||||
&& +# declares a method
|
||||
¡+#walk /distance\ |
|
||||
¡<=/¿+name + " walked " + (+speed * +distance)?\!;
|
||||
!
|
||||
!
|
0
sm-test-files/animals-example/cat.sm
Normal file
0
sm-test-files/animals-example/cat.sm
Normal file
0
sm-test-files/animals-example/dog.sm
Normal file
0
sm-test-files/animals-example/dog.sm
Normal file
Loading…
Reference in a new issue