logoalt Hacker News

konartlast Sunday at 6:47 PM2 repliesview on HN

I may be missing something but come Go has a simple:

    `A
       simple
          formatted
             string
    `

?

Replies

rybosomelast Sunday at 7:03 PM

Yours is rendered as:

A\n\tsimple\n\t\tformatted\n\t\t\tstring\n\t

If you wanted it without the additional indentation, you’d need to use a function to strip that out. Typescript has dedent which goes in front of the template string, for example. I guess in Zig that’s not necessary which is nice.

show 2 replies
xigoilast Sunday at 10:19 PM

The problem is that usually you have something like

  fn main() {
    if something {
      print(`A
  simple
  formatted
  string`)
    }
  }
which looks ugly and confusing.