Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed "Output"- All remaining files #2223

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions concepts/booleans/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ Booleans in Go are represented by the `bool` type, which values can be either `t
Go supports three [boolean operators][logical operators]: `!` (NOT), `&&` (AND), and `||` (OR).

```go
true || false // Output: true
true && false // Output: false
!true // Output: false
true || false // => true
true && false // => false
!true // => false
```

The three boolean operators each have a different [_operator precedence_][operators]. As a consequence, they are evaluated in this order: `!` first, `&&` second, and finally `||`. If you want to 'escape' these rules, you can enclose a boolean expression in parentheses (`()`), as the parentheses have an even higher operator precedence.

```go
!true && false // Output: false
!(true && false) // Output: true
!true && false // => false
!(true && false) // => true
```

[operators]: https://golang.org/ref/spec#Operators
Expand Down
10 changes: 5 additions & 5 deletions concepts/booleans/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ A `bool` is either `true` or `false`.
Go supports three boolean operators: `!` (NOT), `&&` (AND), and `||` (OR).

```go
true || false // Output: true
true && false // Output: false
!true // Output: false
true || false // => true
true && false // => false
!true // => false
```

The three boolean operators each have a different _operator precedence_.
As a consequence, they are evaluated in this order: `!` first, `&&` second, and finally `||`.
If you want to force a different ordering, you can enclose a boolean expression in parentheses (ie. `()`), as the parentheses have an even higher operator precedence.

```go
!true && false // Output: false
!(true && false) // Output: true
!true && false // => false
!(true && false) // => true
```
2 changes: 1 addition & 1 deletion concepts/conditionals-if/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if v := 2 * num; v > 10 {
} else {
fmt.Println(num)
}
// Output: 14
// => 14
```

> Note: any variables created in the initialization statement go out of scope after the end of the if statement.
Expand Down
2 changes: 1 addition & 1 deletion concepts/conditionals-if/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if v := 2 * num; v > 10 {
} else {
fmt.Println(num)
}
// Output: 14
// => 14
```

> Note: any variables created in the initialization statement go out of scope after the end of the if statement.
4 changes: 2 additions & 2 deletions concepts/constants/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ func main() {
const m = map[int]int{2: 8}
const s = []string{"exercism", "v3"}
}
// Output: const initializer map[int]int literal is not a constant
// Output: const initializer []string literal is not a constant
// => const initializer map[int]int literal is not a constant
// => const initializer []string literal is not a constant
```

For a fuller explanation please see the resources [here][const2], [here][const3], and [here][const4].
Expand Down
2 changes: 1 addition & 1 deletion concepts/constants/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ const (
g
)
fmt.Print(a, b, c, d, e, f, g)
// Output: 9 9 9 3 4 5 6
// => 9 9 9 3 4 5 6
```
2 changes: 1 addition & 1 deletion concepts/first-class-functions/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func espGreeting(name string) string {

greeting := espGreeting
dialog("Alice", greeting)
// Output:
// =>
// ¡Hola Alice, mucho gusto!
// I'm a dialog bot.
```
Expand Down
2 changes: 1 addition & 1 deletion concepts/first-class-functions/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func espGreeting(name string) string {

greeting := espGreeting
dialog("Alice", greeting)
// Output:
// =>
// ¡Hola Alice, mucho gusto!
// I'm a dialog bot.
```
Expand Down
6 changes: 3 additions & 3 deletions concepts/for-loops/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ for sum < 1000 {
sum += sum
}
fmt.Println(sum)
// Output: 1024
// => 1024
```

By omitting the init and post component in a for loop like shown above, you create a while loop in Go.
Expand All @@ -57,7 +57,7 @@ for n := 0; n <= 5; n++ {
}
fmt.Println(n)
}
// Output:
// =>
// 0
// 1
// 2
Expand All @@ -72,7 +72,7 @@ for n := 0; n <= 5; n++ {
}
fmt.Println(n)
}
// Output:
// =>
// 1
// 3
// 5
Expand Down
2 changes: 1 addition & 1 deletion concepts/maps/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ import "reflect"

equal := reflect.DeepEqual(map[string]int{}, map[string]int{})
fmt.Println(equal)
// Output: true
// => true
```

_But wait, if map isn't a comparable why are we able to compare them with `nil`? Well, the spec has made an exception for this, see the [comparable spec][gospec-comparable]_
Expand Down
6 changes: 3 additions & 3 deletions concepts/methods/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (p Person) Greetings() string {

s := Person{Name: "Bronson"}
fmt.Println(s.Greetings())
// Output: Welcome Bronson !
// => Welcome Bronson !

```

Expand All @@ -43,11 +43,11 @@ func (r *rect) squareIt() {

r := rect{width: 10, height: 20}
fmt.Printf("Width: %d, Height: %d\n", r.width, r.height)
// Output: Width: 10, Height: 20
// => Width: 10, Height: 20

r.squareIt()
fmt.Printf("Width: %d, Height: %d\n", r.width, r.height)
// Output: Width: 10, Height: 10
// => Width: 10, Height: 10
```

You can find several examples [here][pointers_receivers]. Also checkout this short tutorial about [methods][methods_tutorial].
Expand Down
6 changes: 3 additions & 3 deletions concepts/methods/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (p Person) Greetings() string {

s := Person{Name: "Bronson"}
fmt.Println(s.Greetings())
// Output: Welcome Bronson !
// => Welcome Bronson !
```

There are two types of receivers, value receivers, and pointer receivers.
Expand All @@ -43,10 +43,10 @@ func (r *rect) squareIt() {

r := rect{width: 10, height: 20}
fmt.Printf("Width: %d, Height: %d\n", r.width, r.height)
// Output: Width: 10, Height: 20
// => Width: 10, Height: 20

r.squareIt()
fmt.Printf("Width: %d, Height: %d\n", r.width, r.height)
// Output: Width: 10, Height: 10
// => Width: 10, Height: 10

```
4 changes: 2 additions & 2 deletions concepts/numbers/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ var x int = 42
f := float64(x)

fmt.Printf("x is of type: %s\n", reflect.TypeOf(x))
// Output: x is of type: int
// => x is of type: int

fmt.Printf("f is of type: %s\n", reflect.TypeOf(f))
// Output: f is of type: float64
// => f is of type: float64
```

For more information on Type Conversion please see
Expand Down
4 changes: 2 additions & 2 deletions concepts/numbers/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ var x int = 42
f := float64(x)

fmt.Printf("x is of type: %s\n", reflect.TypeOf(x))
// Output: x is of type: int
// => x is of type: int

fmt.Printf("f is of type: %s\n", reflect.TypeOf(f))
// Output: f is of type: float64
// => f is of type: float64
```
6 changes: 3 additions & 3 deletions concepts/pointers/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ var pa *int
pa = &a // 'pa' now contains to the memory address of 'a'
*pa = *pa + 2 // increment by 2 the value at memory address 'pa'

fmt.Println(a) // Output: 4
fmt.Println(a) // => 4
// 'a' will have the new value that was changed via the pointer!
```

Expand Down Expand Up @@ -123,7 +123,7 @@ When we have a pointer to a struct, we don't need to dereference the pointer bef
var p *Person
p = &Person{Name: "Peter", Age: 22}

fmt.Println(p.Name) // Output: "Peter"
fmt.Println(p.Name) // => "Peter"
// Go automatically dereferences 'p' to allow
// access to the 'Name' field
```
Expand All @@ -147,7 +147,7 @@ ages := map[string]int{
}
incrementPeterAge(ages)
fmt.Println(ages)
// Output: map[Peter:22]
// => map[Peter:22]
// The changes the function 'incrementPeterAge' made to the map are visible after the function ends!
```

Expand Down
6 changes: 3 additions & 3 deletions concepts/pointers/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ var pa *int
pa = &a // 'pa' now contains to the memory address of 'a'
*pa = *pa + 2 // increment by 2 the value at memory address 'pa'

fmt.Println(a) // Output: 4
fmt.Println(a) // => 4
// 'a' will have the new value that was changed via the pointer!
```

Expand Down Expand Up @@ -123,7 +123,7 @@ When we have a pointer to a struct, we don't need to dereference the pointer bef
var p *Person
p = &Person{Name: "Peter", Age: 22}

fmt.Println(p.Name) // Output: "Peter"
fmt.Println(p.Name) // => "Peter"
// Go automatically dereferences 'p' to allow
// access to the 'Name' field
```
Expand All @@ -147,7 +147,7 @@ ages := map[string]int{
}
incrementPeterAge(ages)
fmt.Println(ages)
// Output: map[Peter:22]
// => map[Peter:22]
// The changes the function 'incrementPeterAge' made to the map are visible after the function ends!
```

Expand Down
2 changes: 1 addition & 1 deletion concepts/randomness/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func main() {
}
```

Every time this program runs, it will produce the same output:
Every time this program runs, it will produce the same =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The substitution here is not needed


```text
498081 727887 131847
Expand Down
18 changes: 9 additions & 9 deletions concepts/runes/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,31 @@ Since `rune` is just an alias for `int32`, printing a rune's type will yield `in
```go
myRune := '¿'
fmt.Printf("myRune type: %T\n", myRune)
// Output: myRune type: int32
// => myRune type: int32
```

Similarly, printing a rune's value will yield its integer (decimal) value:

```go
myRune := '¿'
fmt.Printf("myRune value: %v\n", myRune)
// Output: myRune value: 191
// => myRune value: 191
```

To print the Unicode character represented by the rune, use the `%c` formatting verb:

```go
myRune := '¿'
fmt.Printf("myRune Unicode character: %c\n", myRune)
// Output: myRune Unicode character: ¿
// => myRune Unicode character: ¿
```

To print the Unicode code point represented by the rune, use the `%U` formatting verb:

```go
myRune := '¿'
fmt.Printf("myRune Unicode code point: %U\n", myRune)
// Output: myRune Unicode code point: U+00BF
// => myRune Unicode code point: U+00BF
```

Besides defining a rune by wrapping the character in single quotes, you can also specify the hexadecimal or decimal number:
Expand All @@ -71,7 +71,7 @@ Besides defining a rune by wrapping the character in single quotes, you can also
myRune := rune(0xbf)
myRune = 191
fmt.Printf("myRune Unicode character: %c\n", myRune)
// Output: myRune Unicode character: ¿
// => myRune Unicode character: ¿
```

## Runes and Strings
Expand All @@ -85,7 +85,7 @@ myString := "❗hello"
for index, char := range myString {
fmt.Printf("Index: %d\tCharacter: %c\t\tCode Point: %U\n", index, char, char)
}
// Output:
// =>
// Index: 0 Character: ❗ Code Point: U+2757
// Index: 3 Character: h Code Point: U+0068
// Index: 4 Character: e Code Point: U+0065
Expand All @@ -104,7 +104,7 @@ stringLength := len(myString)
numberOfRunes := utf8.RuneCountInString(myString)

fmt.Printf("myString - Length: %d - Runes: %d\n", stringLength, numberOfRunes)
// Output: myString - Length: 8 - Runes: 6
// => myString - Length: 8 - Runes: 6
```

## Type Converting Runes
Expand All @@ -115,7 +115,7 @@ A slice of runes can be type converted to a string:
myRuneSlice := []rune{'e', 'x', 'e', 'r', 'c', 'i', 's', 'm'}
myString := string(myRuneSlice)
fmt.Println(myString)
// Output: exercism
// => exercism
```

Similarly, a string can be type converted to a slice of runes. Remember, without formatting verbs, printing a rune yields its integer (decimal) value:
Expand All @@ -124,5 +124,5 @@ Similarly, a string can be type converted to a slice of runes. Remember, without
myString := "exercism"
myRuneSlice := []rune(myString)
fmt.Println(myRuneSlice)
// Output: [101 120 101 114 99 105 115 109]
// => [101 120 101 114 99 105 115 109]
```
12 changes: 6 additions & 6 deletions concepts/runes/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,31 @@ Since `rune` is just an alias for `int32`, printing a rune's type will yield `in
```go
myRune := '¿'
fmt.Printf("myRune type: %T\n", myRune)
// Output: myRune type: int32
// => myRune type: int32
```

Similarly, printing a rune's value will yield its integer (decimal) value:

```go
myRune := '¿'
fmt.Printf("myRune value: %v\n", myRune)
// Output: myRune value: 191
// => myRune value: 191
```

To print the Unicode character represented by the rune, use the `%c` formatting verb:

```go
myRune := '¿'
fmt.Printf("myRune Unicode character: %c\n", myRune)
// Output: myRune Unicode character: ¿
// => myRune Unicode character: ¿
```

To print the Unicode code point represented by the rune, use the `%U` formatting verb:

```go
myRune := '¿'
fmt.Printf("myRune Unicode code point: %U\n", myRune)
// Output: myRune Unicode code point: U+00BF
// => myRune Unicode code point: U+00BF
```

## Runes and Strings
Expand All @@ -76,7 +76,7 @@ myString := "❗hello"
for index, char := range myString {
fmt.Printf("Index: %d\tCharacter: %c\t\tCode Point: %U\n", index, char, char)
}
// Output:
// =>
// Index: 0 Character: ❗ Code Point: U+2757
// Index: 3 Character: h Code Point: U+0068
// Index: 4 Character: e Code Point: U+0065
Expand All @@ -95,5 +95,5 @@ stringLength := len(myString)
numberOfRunes := utf8.RuneCountInString(myString)

fmt.Printf("myString - Length: %d - Runes: %d\n", stringLength, numberOfRunes)
// Output: myString - Length: 8 - Runes: 6
// => myString - Length: 8 - Runes: 6
```
Loading