Go – Reversing a String

As a little example of basic Golang, I wrote a little app that takes user input and reverses the word as output:

package main

import "fmt"

var userInput string

func main() {

func reverseWord() {

   fmt.Println("Input a word> ")
   var word_length int = len(userInput)
   for i := word_length; i > 0; i-- {
      fmt.Print(userInput[(i - 1):i])

Leave your vote

0 points
Upvote Downvote

Total votes: 0

Upvotes: 0

Upvotes percentage: 0.000000%

Downvotes: 0

Downvotes percentage: 0.000000%

About Admin 329 Articles
I work for a Telecom company writing and testing software. My passion for writing code is expressed through this blog. It's my hope that it gives hope to any and all who are self-taught.