Created
April 20, 2020 16:57
-
-
Save wicky-andrian/8cff395e43144da5b7dd07d788dafe01 to your computer and use it in GitHub Desktop.
Contoh metode string part 4
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
a = "Ruby" | |
puts a | |
puts "Objek ID: #{a.object_id}" | |
puts a.replace('Java') | |
puts "Objek ID: #{a.object_id}" | |
b = a.replace('PHP') | |
puts b | |
puts "Objek ID #{b.object_id}" | |
# output program di atas | |
Ruby | |
Objek ID: 60 | |
Java | |
Objek ID: 60 | |
PHP | |
Objek ID 6 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment