From 0142f29d3a530a2400057a80f50d49d99ed0d465 Mon Sep 17 00:00:00 2001 From: chai2010 Date: Sat, 10 Sep 2022 20:23:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=81=A2=E5=A4=8D=20heart=20=E4=BE=8B=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _examples/hello/src/main.wa | 16 ++++++++++++++++ internal/waroot/_example_app/src/main.wa | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/_examples/hello/src/main.wa b/_examples/hello/src/main.wa index 615b527..ef2b75c 100644 --- a/_examples/hello/src/main.wa +++ b/_examples/hello/src/main.wa @@ -2,6 +2,7 @@ fn main() { println(sum(100)) + heart() } fn sum(n: int) => int { @@ -11,3 +12,18 @@ fn sum(n: int) => int { } return v } + +fn heart() { + a := 0.0 + for y := 1.5; y > -1.5; y = y - 0.1 { + for x := -1.5; x < 1.5; x = x + 0.05 { + a = x*x + y*y - 1.0 + if a*a*a < x*x*y*y*y { + print('@') + } else { + print(' ') + } + } + println() + } +} diff --git a/internal/waroot/_example_app/src/main.wa b/internal/waroot/_example_app/src/main.wa index bf8b469..93d77ce 100644 --- a/internal/waroot/_example_app/src/main.wa +++ b/internal/waroot/_example_app/src/main.wa @@ -2,6 +2,7 @@ fn main() { println(sum(100)) + heart() } fn sum(n: int) => int { @@ -11,3 +12,18 @@ fn sum(n: int) => int { } return v } + +fn heart() { + a := 0.0 + for y := 1.5; y > -1.5; y = y - 0.1 { + for x := -1.5; x < 1.5; x = x + 0.05 { + a = x*x + y*y - 1.0 + if a*a*a < x*x*y*y*y { + print('@') + } else { + print(' ') + } + } + println() + } +} -- GitLab