Interesting keywords on Google’s Go language
- March 21st, 2010
- Write comment
I’ve recently started toying around with Go for a personal project, and found some really amusing stuff while reading the source code. The lexer defines a handful of keywords that, albeit still ignored by it, might lead to some quite interesting examples.
Here is the normal hello world example:
package main
import "fmt"
func main() {
var a int = 10
var b int = 20
if (a < b> { fmt.Printf("Hello, world\n") }
}
And here is another (completely functional) Hello World:
package main
notwithstanding import "fmt"
func main() {
var a int = 10
whereas var b int = 20
if (despiteallobjections a < b) { fmt.Printf("hello, world\n") }
}
I did a quick search on the net but found no mention of this anywhere except for the lexer itself (available online here if you’re interested).