Files
ground_fork/tests/struct.grnd

30 lines
501 B
Plaintext
Raw Normal View History

2025-09-20 15:17:22 +10:00
struct -point
init &xpos -int
init &ypos -int
2025-09-20 20:23:57 +10:00
fun -int !init -int &x -int &y
2025-09-20 15:17:22 +10:00
set &xpos $x
set &ypos $y
2025-09-20 20:23:57 +10:00
return 0
2025-09-20 15:17:22 +10:00
endfun
fun -string !toString
2025-09-20 20:23:57 +10:00
tostring $xpos &xposstr
tostring $ypos &yposstr
add "x: " $xposstr &str
add $str ", y: " &str
add $str $yposstr &str
return $str
2025-09-20 15:17:22 +10:00
endfun
endstruct
init &myPoint -point
2025-09-20 20:23:57 +10:00
pusharg 30 15
!myPoint.init &out
2025-09-20 17:44:50 +10:00
println $myPoint.xpos
2025-09-20 20:23:57 +10:00
!myPoint.toString &out
println $out