From a3ce53bca2262c7e6ef2192c1f9c7028c3a7b118 Mon Sep 17 00:00:00 2001 From: Adam Wick Date: Thu, 11 Apr 2024 09:22:28 -0700 Subject: [PATCH] A more complicated structure test. --- examples/basic/struct0003.ngr | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 examples/basic/struct0003.ngr diff --git a/examples/basic/struct0003.ngr b/examples/basic/struct0003.ngr new file mode 100644 index 0000000..ac46800 --- /dev/null +++ b/examples/basic/struct0003.ngr @@ -0,0 +1,27 @@ +struct Point { + x: u64; + y: u64; +} + +struct Line { + start: Point; + end: Point; +} + +function slope(l) -> u64 + (l.end.y - l.start.y) / (l.end.x - l.start.x); + +test = Line { + start: Point { + x: 1; + y: 2; + }; + end: Point { + x: 2; + y: 4; + }; +}; + +foo = slope(test); + +print foo; \ No newline at end of file