Skip to content

Commit

Permalink
Fix code examples and improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroenlm authored and turbolent committed Mar 1, 2021
1 parent d19d993 commit 774f5a3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/language/composite-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ of the composite type requires them.

Composite types can only be declared within [contracts](../contracts)
and not locally in functions.
They can also not be nested.


Resource must be created (instantiated) by using the `create` keyword
and calling the type like a function.
Expand Down Expand Up @@ -924,7 +924,7 @@ res.value
// This function is invalid, because it does not always use the resource parameter,
// which would cause a loss of the resource.
//
pub fun sometimesDestroy(resource: @SomeResource, destroy: Bool) {
pub fun sometimesDestroy(resource: @SomeResource, destroyResource: Bool) {
if destroyResource {
destroy resource
}
Expand Down
2 changes: 1 addition & 1 deletion docs/language/functions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ A function may refer to variables and constants of its outer scopes
in which it is defined.
It is called a closure, because
it is closing over those variables and constants.
A closure can can read from the variables and constants
A closure can read from the variables and constants
and assign to the variables it refers to.

```cadence
Expand Down
6 changes: 3 additions & 3 deletions docs/language/restricted-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ pub resource Counter: HasCount {
// Create an instance of the resource `Counter`
let counter: @Counter <- create Counter(count: 42)
counterRef.count // is `42`
counter.count // is `42`
counterRef.increment()
counter.increment()
counterRef.count // is `43`
counter.count // is `43`
// Move the resource in variable `counter` to a new variable `restrictedCounter`,
// but typed with the restricted type `Counter{HasCount}`:
Expand Down

0 comments on commit 774f5a3

Please sign in to comment.