added animal class

This commit is contained in:
Schrottkatze 2021-12-16 10:08:08 +01:00
parent e2b1af59b4
commit e9b3337ae4
3 changed files with 26 additions and 0 deletions

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

View file

View file