strath/sm-test-files/animals-example/animal.sm
2021-12-16 10:40:06 +01:00

26 lines
678 B
Text

&& ++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)?\!;
)
)