This repository has been archived on 2024-02-27. You can view files and clone it, but cannot push or open issues or pull requests.
2022-08-03 15:09:00 +00:00
|
|
|
:arf
|
|
|
|
author "Sasha Koshka"
|
|
|
|
license "GPLv3"
|
|
|
|
require "io"
|
|
|
|
---
|
|
|
|
|
|
|
|
# this is a global variable
|
2022-09-17 16:33:52 +00:00
|
|
|
data pv helloText:String:<"Hello, world!">
|
2022-08-03 15:09:00 +00:00
|
|
|
|
|
|
|
# this is a struct definition
|
2022-09-17 16:33:52 +00:00
|
|
|
type ro Greeter:Obj:(
|
|
|
|
.rw text:String:<"Hi.">)
|
2022-08-03 15:09:00 +00:00
|
|
|
|
|
|
|
# this is a function
|
2022-08-20 19:54:10 +00:00
|
|
|
func ro main
|
2022-09-05 15:35:32 +00:00
|
|
|
> arguments:{String ..}
|
2022-09-17 16:33:52 +00:00
|
|
|
< status:Int:<0>
|
2022-08-20 19:54:10 +00:00
|
|
|
---
|
2022-09-17 16:33:52 +00:00
|
|
|
let greeter:Greeter:mut
|
2022-08-20 19:54:10 +00:00
|
|
|
greeter.setText helloText
|
|
|
|
greeter.greet
|
2022-08-03 15:09:00 +00:00
|
|
|
|
|
|
|
# this is a member function
|
2022-08-20 19:54:10 +00:00
|
|
|
func ro greet
|
|
|
|
@ greeter:{Greeter}
|
|
|
|
---
|
|
|
|
io.println greeter.text
|
2022-08-03 15:09:00 +00:00
|
|
|
|
|
|
|
# this is mutator member function
|
2022-08-20 19:54:10 +00:00
|
|
|
func ro setText
|
|
|
|
@ greeter:{Greeter}
|
|
|
|
> text:String
|
|
|
|
---
|
|
|
|
greeter.text.set text
|
2022-08-03 15:09:00 +00:00
|
|
|
|