add: if statement exercises
This commit is contained in:
49
11-if/exercises/04-vowel-or-cons/main.go
Normal file
49
11-if/exercises/04-vowel-or-cons/main.go
Normal file
@@ -0,0 +1,49 @@
|
||||
// For more tutorials: https://blog.learngoprogramming.com
|
||||
//
|
||||
// Copyright © 2018 Inanc Gumus
|
||||
// Learn Go Programming Course
|
||||
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
//
|
||||
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE: Vowel or Consonant
|
||||
//
|
||||
// Detect whether a letter is vowel or consonant.
|
||||
//
|
||||
// NOTE
|
||||
// y or w is called a semi-vowel.
|
||||
// Check out: https://en.oxforddictionaries.com/explore/is-the-letter-y-a-vowel-or-a-consonant/
|
||||
//
|
||||
// HINT
|
||||
// + You can find the length of an argument using the len function.
|
||||
//
|
||||
// + len(os.Args[1]) will give you the length of the 1st argument.
|
||||
//
|
||||
// BONUS
|
||||
// Use strings.IndexAny function to detect the vowels.
|
||||
// Search on Google for: golang pkg strings IndexAny
|
||||
//
|
||||
// EXPECTED OUTPUT
|
||||
// go run main.go
|
||||
// Give me a letter
|
||||
//
|
||||
// go run main.go hey
|
||||
// Give me a letter
|
||||
//
|
||||
// go run main.go a
|
||||
// "a" is a vowel.
|
||||
//
|
||||
// go run main.go y
|
||||
// "y" is sometimes a vowel, sometimes not.
|
||||
//
|
||||
// go run main.go w
|
||||
// "w" is sometimes a vowel, sometimes not.
|
||||
//
|
||||
// go run main.go x
|
||||
// "x" is a consonant.
|
||||
// ---------------------------------------------------------
|
||||
|
||||
func main() {
|
||||
}
|
Reference in New Issue
Block a user