-
Notifications
You must be signed in to change notification settings - Fork 2
Gregory Morrison edited this page Feb 5, 2023
·
4 revisions
I took an initial look at one of Google's newest technologies today - Go, introduced in 2009 - and I liked what I saw. I plan on spending time in the future with this language. It literally took me less than five minutes from the time I first looked at Go to write this version of Euler1:
package main
func euler(size int) int {
retval := 0
for i := 1; i < size; i++ {
if i%3==0 || i%5==0 {
retval += i
}
}
return retval
}
func main() {
println(euler(1000))
}
Go's home page opens up to an interactive code editor, complete with samples, which lets you immediately play with the language. Nothing to install - brilliant! To run, just put your code in the online editor and click Compile and Run:
233168
Return home