Corgi allows you to use both ifs and switches, without having to use - code.
If
Just write an if as you otherwise would in Go, minus the trailing {.
import "strings" "math/rand"func F()- s :="fOo"if s =="foo"p s is 'foo'!else ifstrings.EqualFold(s,"foo")p s is almost 'foo'!if r :=rand.Intn(11); r >=5p I forsee great fortune for you today.
import ("strings""math/rand" _io "io")funcF(_w _io.Writer) error { s :="foo"if s =="foo" {// p s is 'foo'! } elseif strings.EqualFold(s, "foo") {// p s is almost 'foo'! }if r := rand.Intn(11); r >=5 {// p I forsee great fortune for you today. }}
Switch
Similarly, you can write a switch just like in go, just without { and :.
- s :="abc"pswitch scase"foo","bar" > foo, barcase"abc","def","jkl" > alphabet
s :="abc"// <p>switch s {case"foo", "bar":// > foo, barcase"abc", "def", "jkl":// > alphabet }// </p>