44 Views

3rd August 2020

Golang Used As Value

Why I am getting an exception function() used as value?

I wrote a program which converts all the letters into capital letters but I am getting an exception called function() used as value here is my code

package main 

import ( "fmt" 

"strings" ) 

func capitalize(name string)

 { name = strings.ToTitle(name) 

return } 

func main() 

{ sample := "hello" 

fmt.Println(capitalize(sample)) }

Can anyone give me the exact solution?

 

Answers

8th August 2020

Answered by divija reddy

package main 

import ( "fmt" 

"strings" ) 

func capitalize(name string) 

string { 

return strings.ToTitle(name) } 

func main() { 

sample := "hello" 

fmt.Println(capitalize(sample)) }

 

Write your answer

GET STARTED

Speak with a Learning Advisor

Understand how the industry and practically oriented courses at Mindmajix transform your career.

  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos