github goplus/gop v0.6.40
Release v0.6.40

latest releases: v1.2.6, v1.2.5, v1.2.3-p2...
3 years ago

Playground

Playground based on Docker (See https://github.com/qiniu/goplus-www/tree/master/playground):

Playground based on GopherJS (See https://github.com/qiniu/goplus-play):

Thanks contribution of qiukeren (qiukeren@goplus.org), visualfc (visualfc@goplus.org).

For loop

Thanks contribution of JessonChan (chendongpo@goplus.org)

fns := make([]func() int, 3)
sum := 0
for _, x := range [1, 3, 5, 7, 11, 13, 17] {
    if x > 3 {
        sum += x
    }
}
println("sum(5,7,11,13,17):", sum)

sum = 0
for i, x := range [3, 15, 777] {
    v := x
    fns[i] = func() int {
        return v
    }
}
println("values:", fns[0](), fns[1](), fns[2]())

sum = 0
arr := [1, 3, 5, 7, 11, 13, 17]
i := 10
for i = 0; i < len(arr); i++ {
    if arr[i] > 3 {
        sum += arr[i]
    }
}
println("sum(5,7,11,13,17):", sum)

Inc/DecStmt

Thanks contribution of JessonChan (chendongpo@goplus.org)

a, b := 2, 3
a++
b--
println(a, b)

Don't miss a new gop release

NewReleases is sending notifications on new releases.