Post

GoLangGoLang

H
Harish Harsh

Posted on 4th March 2024|1095 views

0
votes

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
P
divija reddy

Posted on 4th March 2024

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

STILL GOT QUERIES?

Get a Live FREE Demo
  • 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