Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Commit

Permalink
Update abilities.md
Browse files Browse the repository at this point in the history
Add lint and rename c_n to n.
  • Loading branch information
feliciss authored Jul 1, 2023
1 parent 8f5303a commit ba367cc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions language/documentation/book/src/abilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Here are examples for this conditional system for each ability:

### Example: conditional `copy`

```
```move
struct NoAbilities {}
struct S has copy, drop { f: bool }
struct Cup<T> has copy, drop, store { item: T }
Expand All @@ -160,7 +160,7 @@ fun invalid(c_account: Cup<signer>, c_n: Cup<NoAbilities>) {

### Example: conditional `drop`

```
```move
struct NoAbilities {}
struct S has copy, drop { f: bool }
struct Cup<T> has copy, drop, store { item: T }
Expand All @@ -187,15 +187,15 @@ fun invalid_unused() {
fun invalid_left_in_local(): u64 {
let n = Cup<NoAbilities> { item: NoAbilities {}};
// Invalid return: 'c_n' has a value
// Invalid return: 'n' has a value
// and 'Cup<NoAbilities>' does not have 'drop'
0
}
```

### Example: conditional `store`

```
```move
struct Cup<T> has copy, drop, store { item: T }
// 'MyInnerResource' is declared with 'store' so all fields need 'store'
Expand All @@ -214,7 +214,7 @@ struct MyResource has key {

### Example: conditional `key`

```
```move
struct NoAbilities {}
struct MyResource<T> has key { f: T }
Expand Down

0 comments on commit ba367cc

Please sign in to comment.