Skip to content

Instantly share code, notes, and snippets.

@gauravssnl
Forked from JeremyMorgan/shake.go
Created October 30, 2021 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gauravssnl/d29420c437ced1078d2af52baaf76890 to your computer and use it in GitHub Desktop.
Save gauravssnl/d29420c437ced1078d2af52baaf76890 to your computer and use it in GitHub Desktop.
The most important code I've ever written
package main
import (
"fmt";
)
func loopit(phrase string, repeat int)(string){
var outputphrase string = "";
for i := 0; i < repeat; i++ {
outputphrase = outputphrase + " " + phrase;
}
return string(outputphrase);
}
func main() {
var x[6]string
x[0] = "Cause the players gonna"
x[1] = "And the haters gonna"
x[2] = "I'm just gonna"
x[3] = "Heart-breakers gonna"
x[4] = "And the fakers gonna"
x[5] = "Baby, I'm just gonna"
var y[6]string
y[0] = "play"
y[1] = "hate"
y[2] = "shake"
y[3] = "break"
y[4] = "fake"
y[5] = "shake"
for i := 0; i < 6; i++ {
fmt.Printf("%[1]s %[2]s \n", x[i], loopit(y[i], 5));
if (i == 2 || i == 5){
fmt.Printf("%s \n", loopit("Shake it off",2));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment