1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 16:58:06 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-04-02 08:22:30 +08:00
parent acc990ac7f
commit 71c6127c6c
2 changed files with 42 additions and 21 deletions

View File

@ -1,2 +1 @@
# demo script
# back script

View File

@ -1,20 +1,42 @@
# demo script
cmd space
let a = 1;
let a, b = 1, 2
if a > 1 { pwd }
if a, b = 2, 4; a > 1 { pwd }
for a = 2; a < 5; a++ { pwd }
func show(a, b) (c, d) {
let c = system(ls, a)
return
pwd
func inputs(m, key) {
switch key {
case "name":
m.Push(key, "hi")
default:
m.Push(key, "good")
}
}
func list(m, arg, name) {
m.Push("h1", "hi").Push("h1", "he")
m.Table(func(value) { m.Echo(value["h1"]) })
info; m.Cmdy("cli.qrcode", "hello world")
m.Action("list1", "list2", "list3")
}
func list1(m) {
let dict = kit.Dict("a", 1, "b", 2)
m.Echo("%#v", dict).Echo("\n")
m.Echo("%#v", dict["a"]).Echo("\n")
let list = kit.List("a", 1, "b", 2)
m.Echo("%#v", list).Echo("\n")
m.Echo("%#v", list[0]).Echo("\n")
}
func list2(m, name) {
if name == "h1" {
m.Echo("h1")
} else if name == "h2" {
m.Echo("h2")
} else {
m.Echo("h3")
}
}
func list3(m) {
for i = 0; i < 10; i++ {
m.Echo(i)
if i < 5 {
continue
}
if i > 1 {
break
}
}
}
let e, f = show(etc, bin)