Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions golang-basic/latihan/01-chelsa-farah.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package main

import "fmt"

func main() {
fmt.Println(isPalindrome("madam"))
}

func isPalindrome(str string) bool{
for i := 0; i < len(str); i++ {
j := len(str)-1-i
if str[i] != str[j] {
return false
}
}
return true
}
15 changes: 15 additions & 0 deletions golang-basic/latihan/02-chelsa-farah.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package main

import "fmt"

func main() {
isVokal('l')
}

func isVokal(character rune) {
if(character == 'a' || character == 'b' || character =='c' || character =='d' || character =='e'){

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bisa disamakan terlebih dahulu karakternya lowercase atw uppercase ya

fmt.Println("Vokal")
}else{
fmt.Println("Konsonan")
}
}
3 changes: 3 additions & 0 deletions golang-basic/latihan/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module edspert/tutorial-go/golang-basic/latihan

go 1.19
15 changes: 15 additions & 0 deletions golang-basic/latihan/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package main

import "fmt"

func main() {
isVokal('l')
}

func isVokal(character rune) {
if(character == 'a' || character == 'b' || character =='c' || character =='d' || character =='e'){
fmt.Println("Vokal")
}else{
fmt.Println("Konsonan")
}
}