add existing documentation

This commit is contained in:
2024-11-02 15:11:00 +00:00
parent d5c41cbbaa
commit ac92c5317e
9 changed files with 1066 additions and 0 deletions

44
doc/sample/Vehicle.im Executable file
View File

@@ -0,0 +1,44 @@
package net.doorstuck.vehicles
protocol Vehicle
- startup
- shutdown
- nrWheels
- nrDoors
- turn(direction:dir)
- accelerate(direction:dir)
- velocity
end
class Car <Vehicle>
- startup
self.engineRunning = true
end
- shutdown
self.engineRunning = false
end
- nrWheels
^4
end
- nrDoors
^4
end
- turn(direction:dir)
self.currentDirection = dir
end
- accelerate(direction:dir)
match dir
#forward => self.currentVelocity += 1,
#backward => self.currentVelocity -= 1,
end
end
- velicity
^self.currentVelocity
end
end