Ascii Nightmares! Please Help!

Hello! I am on the comic mischief project for Go.

Some of my code is in progress. It works but can be written better. My specific issue is when I added ascii art to the file it wigged out on me.

Here is the code:

package main

import “fmt”

func main () {

asciiArt :=

`

\ \ / / | | | |
\ \ /\ / /| | ___ ___ _ __ ___ ___ | |
\ / / / _ \ |/ / _ | ’ ` _ \ / _ \ | |
\ /\ / / | (| () | | | | | | / |_|
/ / _
|_|_
_
/|| || ||__| (
)

.–. .–.
,-=.-":;:;:;’:;:;:;"-._
\:;:;:;:;:;:;:;:;:;:;
\:;:;:;:;:;:;:;:;:;:;
\:;:;:;:;:;:;:;:;:;:;
\:;:;:;:;:;:;::;:;:;:
\;:;::;:;:;:;:;:;::;:
\;;:;::–:::–:;:;\
\_.-" : "-.

`…–""–.;.–""–…
" "

==============================================================
`

var title, writer, artist, publisher string = “Mr. GoToSleep”, “Tracey Hatchet”, “Jewel Tampson”, “DizzyBooks Publishing Inc.”

var year, pageNumber uint = 1997, 14

var grade float32

//Book Number 1
title = “Mr. GoToSleep”
writer = “Tracey Hatchet”
artist =“Jewel Tampson”
publisher = “DizzyBooks Publishing Inc.”

year = 1997
pageNumber = 14
grade = 6.5

fmt.Println(asciiArt)
fmt.Println(title)
fmt.Println(“Written by:”, writer)
fmt.Println(“Illustrated by:”, artist)
fmt.Println(“Published by:”, publisher)

fmt.Println(“Year published:”, year)
fmt.Println(“Number of pages:”, pageNumber)
fmt.Println(“Condition of book rates at:”, grade)
fmt.Println("=============================")

//Book number 2
title = “Epic Vol. 1”
writer = “Ryan N. Shawn”
artist = “Phoebe paperclips”
publisher = “DizzyBooks Publishing Inc.”

year = 2013
pageNumber = 160
grade = 9.0

fmt.Println(title)
fmt.Println(“Written by:”, writer)
fmt.Println(“Illustrated by:”, artist)
fmt.Println(“Published by:”, publisher)

fmt.Println(“Year published:”, year)
fmt.Println(“Number of pages:”, pageNumber)
fmt.Println(“Condition of book rates at:”, grade)
fmt.Println("============================")
}

Here are the errors:

command-line-arguments

./main.go:13:36: syntax error: unexpected _ at end of statement
./main.go:13:38: invalid character U+005C ‘’
./main.go:14:5: invalid character U+005C ‘’
./main.go:15:6: invalid character U+005C ‘’
./main.go:17:6: syntax error: unexpected --, expecting name or (
./main.go:18:1: syntax error: unexpected comma, expecting }
./main.go:18:14: unknown escape sequence
./main.go:19:1: invalid character U+005C ‘’
./main.go:20:2: invalid character U+005C ‘’
./main.go:21:3: invalid character U+005C ‘’
./main.go:21:3: too many errors

I recognize most of these errors are probably due to the addition of my ASCII stuff, but I thought I would share!

Any help would be greatly appreciated!

-Nick

Interesting, the ascii art is not outputting into this topic the way it looks in the editor or even notepad:
image

Similarly, you have an image instead of what you wrote:

![image|402x333](upload://7Fm09aXqhEh6BaxmL6JrlqGSdgt.png)

So how would you post code without it being interpreted as formatting hints to the forum? You’d tell the forum to … not. Just another formatting instruction in other words.

Your code problem isn’t so different from what you’re doing with your forum post. You have an opening quote and later on a closing quote, and then a whole bunch of stuff not recognized as go code. Your error message tells you exactly where.

You may want to look at that again. That image is to capture what I see on my screen, the code I pasted shows completely different than what it looks like in my ide or in notepad.

I am not pasting an image file into my code editor.

I appreciate your reply. I am either not following what you’re saying which may be the case, or I have not done a good job explaining or demonstrating the issue I am dealing with.

I willing to guess probably all the above. Apologies.

No, you wrote some special text that got interpreted as an image. Note that this did not remain an exact copy of that text.
Same thing with your code. It did not remain an exact copy of that text.

Same as in your go code, text you write in a forum post is interpreted according to rules to produce some kind of result. If you want to avoid those rules, you’ll need to make use of some such rule which exempts/escapes the things you wrote

If you for example put a # in front of your text you get really big text

or you can use <sub> or <sup> to write really small text

You can’t insert ANY text and expect it to not run into formatting rules like those ^ (you could even intentionally use text which will display differently from the text itself)

In go you have quotes for representing non-code text. You used a backtick to start it, then another to end it. But after your closing backtick you have a bunch of gibberish

Since you have an error message telling you a location… go look at that location and reconsider what you put there.

In short:

The text you write has rules applied to it.
You can leverage those rules to get things to happen.
But it’ll do exactly as you specify, so you better specify carefully.

And, you’re lucky enough to have error messages telling you things about the nature of the problem.
If they’re too many for you to consider all at once, consider having less things in your code that could be bad, start with a small piece of it?

Hello, @csspro46003, and welcome to the Codecademy Forums!

Have you solved the problem that caused your ASCII nightmare? If not, then consider that the computer doesn’t know what you intended for it to do. It only knows what you told it to do.

Here, you specify that the computer should start a string:

asciiArt :=

`
\ \ / / | | | |


Where did you want it to end the string? Is that the same place where your code actually specifies that the string should end?

According to the error message, the computer unsuccessfully attempted to interpret a _ character. Evidently, it was not regarded as being part of a string. Can you find such a character in your code that you intended to include in a string, but that was interpreted, instead, as occurring outside the string?