提交 19d93115 编写于 作者: 3 3dgen

Merge branch 'master' of https://github.com/wa-lang/wa

...@@ -61,9 +61,9 @@ graph LR ...@@ -61,9 +61,9 @@ graph LR
``` ```
// 版权 @2021 凹语言™ 作者。保留所有权利。 // 版权 @2021 凹语言™ 作者。保留所有权利。
fn main() { 函数 main() {
for n := 2; n <= 30; n = n + 1 { for n := 2; n <= 30; n = n + 1 {
let isPrime int = 1 变量 isPrime int = 1
for i := 2; i*i <= n; i = i + 1 { for i := 2; i*i <= n; i = i + 1 {
if x := n % i; x == 0 { if x := n % i; x == 0 {
isPrime = 0 isPrime = 0
......
// 版权 @2022 _examples/hello 作者。保留所有权利。 // 版权 @2022 _examples/hello 作者。保留所有权利。
import ( 导入 "fmt"
"fmt"
import (
"3rdparty/pkg" "3rdparty/pkg"
"myapp/mymath" "myapp/mymath"
"myapp/mypkg" "myapp/mypkg"
) )
fn main() { 函数 main() {
fmt.Println(42) fmt.Println(42)
pkg.Println(42 + 1) pkg.Println(42 + 1)
mypkg.Println(sum(100)) mypkg.Println(求和(100))
mymath.PrintPrime(30) mymath.PrintPrime(30)
heart() heart()
} }
fn sum(n int) int { 函数 求和(n int) int {
let v int let v int
for i := 1; i <= n; i++ { for i := 1; i <= n; i++ {
v += i v += i
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册