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

fix: better wording, styling #155

Merged
merged 9 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
5 changes: 3 additions & 2 deletions src/tutorials/gno.land/gbe/01-hello/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ title: Hello World
section: Getting Started
---

This is the simplest application that you can create using Gno. `Render(string) string` is a special method that will be
used by `gnoweb` to render markdown output.
This is the simplest application that you can create using Gno.
`Render(string) string` is a special method that will be used by `gnoweb` to
render markdown output.

```go file=./hello.gno
```
Expand Down
5 changes: 3 additions & 2 deletions src/tutorials/gno.land/gbe/02-count/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ title: First App
section: Getting Started
---

Let's create our first application. This realm is able to add and substract from a global count variable using `Add()`
and `Remove()` methods. The state will be saved between executions.
Let's create our first application. This realm is able to add and subtract from
a global count variable using `Add()` and `Subtract()` methods. The state will
be saved between executions.

<!--TODO: add an example about how to deploy this realm and how to call to Add() and Remove() using the command line -->

Expand Down
4 changes: 2 additions & 2 deletions src/tutorials/gno.land/gbe/02-count/count.gno
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ func Add() {
count++
}

func Remove() {
func Subtract() {
count--
}
}
4 changes: 2 additions & 2 deletions src/tutorials/gno.land/gbe/02-count/count_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ func TestCount(t *testing.T) {
Add()
Add()
Add()
Remove()
Subtract()
got := Render("")
expected := "Count: 2"
if got != expected {
t.Fatalf("expected %q, got %q.", expected, got)
}
}
}
8 changes: 6 additions & 2 deletions src/tutorials/gno.land/gbe/03-primitives/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ title: Primitives
section: Getting Started
---

Example using primitives.
Take into account that special types that are not in Go language will be implemented for easy of usage, like bigint.
Below are primitives that are available in Gno.
Take into account that some special types that do not originally exist in the Go
language will be implemented in Gno. One such example is `bigint`.

You can view the full compatibility table for Go & Gno
[here](https://docs.gno.land/reference/go-gno-compatibility).

```go file=./primitives.gno
```
Expand Down
3 changes: 2 additions & 1 deletion src/tutorials/gno.land/gbe/04-variables/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ title: Variables
section: Getting Started
---

Global variables will keep the state between executions, but that is not the case for variables outside the global context, like inside functions:
Global variables will keep the state between calls (transactions), but that is
not the case for variables outside the global context, such as inside functions:

```go file=./variables.gno
```
18 changes: 10 additions & 8 deletions src/tutorials/gno.land/gbe/04-variables/variables.gno
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
package variables

import "fmt"
import (
"gno.land/p/demo/ufmt"
)

// this variable will keep the state between realm calls
// This variable will keep the state between realm calls
var count int

func Render(name string) string {
// adding one to the global variable to keep track of Render calls
// Adding one to the global variable to keep track of Render calls
count++

// this variable is created at function scope, so it won't be persisted on the realm state.
hi := fmt.Sprintf("Hello %s!", name)
return fmt.Sprintf("%s. Call number %d", hi, count)
}
// This variable is created at function scope, so it won't be persisted on the realm state.
hi := ufmt.Sprintf("Hello %s!", name)

return ufmt.Sprintf("%s. Call number %d", hi, count)
}
6 changes: 2 additions & 4 deletions src/tutorials/gno.land/gbe/05-constants/constants.gno
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package constants

import "fmt"

const s = "constant string"

func Render(name string) string {
// we cannot change the assignment on a constant,
// we cannot change the assignment on a constant,
// so this line will fail when compiling
// s = "other value"

return s
}
}
4 changes: 3 additions & 1 deletion src/tutorials/gno.land/gbe/06-conditions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ title: Conditions
section: Getting Started
---

As in Go, we have two ways to check for specific conditions, using `if` statements and `switch`es:
In Gno, we have two ways to check for specific conditions:
- `if` statements
- `switch` statements:

```go file=./conditions.gno#L5-L13
```
Expand Down
4 changes: 3 additions & 1 deletion src/tutorials/gno.land/gbe/07-loops/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ title: Loops
section: Getting Started
---

Loops works as in standard Go, but you have to be careful to always check for the right condition to break it, if not your application will consume all the available Gas.
Loops work just like you would expect, but you have to be careful to always check
for the right condition to break out of them. If you do not, your application will
consume all available gas and stop execution.

```go file=./loops.gno#L19-L46
```
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10661,9 +10661,9 @@ typedarray-to-buffer@^3.1.5:
is-typedarray "^1.0.0"

typescript@^5.3.3:
version "5.3.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37"
integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==
version "5.4.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611"
integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==

unbox-primitive@^1.0.2:
version "1.0.2"
Expand Down
Loading