Files
Claro/examples/objects_classes.claro
T

32 lines
443 B
Plaintext

SAY "Objects in Claro"
CLASS Player
HAS name TEXT
HAS score NUMBER
TEACH show
SAY "Player name:"
SAY name
SAY "Player score:"
SAY score
END
TEACH add points
SET score score + points
END
END
NEW Player player
SET player.name "Jon"
SET player.score 10
DO player.show
DO player.add 5
SAY "New score:"
SAY player.score
OBJECT CLASS player AS kind
SAY "Object class:"
SAY kind