-
-
Save pakMann/e45992a42a3d6691c1c8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class Pacar | |
| #buat dulu pacar nya | |
| def initialize | |
| @pacar = ['Dian','Putri','Yasmin','Rena'] #<~ nama calon pacarnya | |
| @tipe = ['lucu','cantik','imut','ngegemesin'] #<~ tipe nya | |
| @gaada = "! eh ga jadi ternyata gapunya :(" #<~ kalo gapunya... | |
| end | |
| # Aku pengen cari pacar... | |
| def cari_pacar(target = nil) | |
| if target == "jelek" || target == nil | |
| dapet = @gaada #<~ kalo jelek | |
| elsif target == "ganteng" | |
| dapet = @pacar.shuffle[0] #<~ kalo ganteng... | |
| end | |
| "aku ingin mencari pacar yang bernama #{dapet} " + (target == "ganteng" ? "dia #{@tipe.shuffle[0]} banget !! :*" : "") | |
| end | |
| def jomblo | |
| "Kamu Jomblo ? mungkin si #{@pacar.shuffle[0]} mau jadi pacar kamu " | |
| end | |
| end | |
| #oke aku sekarang mau cari pacar... | |
| cowo = Pacar.new | |
| puts "[Si Jeksen] "+cowo.cari_pacar("ganteng") #<~ kalo kamu ganteng | |
| puts "[Si Jarwo] "+cowo.cari_pacar("jelek") #<~ kalo kamu nya jelek | |
| puts "[Si Jomblo] "+cowo.jomblo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment