-
-
Save gauravssnl/d29420c437ced1078d2af52baaf76890 to your computer and use it in GitHub Desktop.
The most important code I've ever written
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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