• Profile
  • Resume
  • Portfolio
  • Blog
Avatar

Nelson Silva

A human. Being. Coffee lover.

Blog

I Write My Thoughts Here

Println() function and Strings em Go

April 19, 2022 Go

In this post, you will learn how to work with the Println() function and with strings so that you can use that same knowledge and thus evolve.

  • the Println() function prints all its content on the command line and re-lines it (then we have the Print() function that doesn’t wrap lines and the Printf() function that puts values in certain places - of course we will use this last method during the series, and at this point I’ll explain better the working of this function - Printf());
  • a string is a set of characters (letters, numbers and/or symbols);
  • all strings are initialized and ended with quotes (“string”);
  • the escaped character is \ and aims to make the character that follows part of the string.
  • you can increment (join the contents of the various strings) with a comma.
package main

import "fmt"

func main() {
	fmt.Println("We are using the Println() function and I am a string.")
	fmt.Println("Maria said that Miguel was \"sick\".") // Maria said that Miguel was "sick".
	fmt.Println("Caffeine", "Algorithm") // Caffeine Algorithm
}

Don’t forget to watch the video and you can always read this post in Portuguese.

Happy coding!

Previous Next

Categories

  • Announcements
  • Python
  • C#
  • Java
  • Go

Latest Posts

  • for Loop in Go
    May 5, 2022
  • Switch in Go
    May 4, 2022
  • Comparison Operators in Go
    May 3, 2022
+351913416022
contact@nelsonsilvadev.com
Porto, Portugal
Nelson Silva © 2022 All Rights Reserved