Skip to content

Commit

Permalink
change headers and links
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewvious committed Aug 28, 2023
1 parent f5c3ec7 commit 2ba270d
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions docs/book/src/appendix/keywords.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
# [Appendix A: Keywords](#appendix-a-keywords)
# Appendix A: Keywords

The following list contains keywords that are reserved for current or
future use by the Sway language. As such, they cannot be used as
identifiers. Identifiers are names of functions, variables,
parameters, modules, constants, attributes, types or
traits, ect.

## [Keywords Currently in Use](#keywords-currently-in-use)
## Keywords Currently in Use

The following is a list of keywords currently in use, with their
functionality described.

- `as` - rename items in `use` statements, eg `use type::a as alias_name`
- [`abi`](https://fuellabs.github.io/sway/master/book/sway-program-types/smart_contracts.html#the-abi-declaration) - defines a smart contract ABI in a syntactcally similar way to traits
- [`break`](https://fuellabs.github.io/sway/v0.44.0/book/basics/control_flow.html#break-and-continue) - exit a loop immediately
- [`const`](https://fuellabs.github.io/sway/v0.44.0/book/basics/constants.html) - define constant items
- [`continue`](https://fuellabs.github.io/sway/v0.44.0/book/basics/control_flow.html#break-and-continue) - continue to the next loop iteration
- [`abi`](/docs/book/src/sway-program-types/smart_contracts.md) - defines a smart contract ABI in a syntactcally similar way to traits
- [`break`](/docs/book/src/basics/control_flow.md) - exit a loop immediately
- [`const`](/docs/book/src/basics/constants.md) - define constant items
- [`continue`](/docs/book/src/basics/control_flow.md) - continue to the next loop iteration
- `else` - used in conjunction with `if` conditions for control flow constructs
- [`enum`](https://fuellabs.github.io/sway/v0.44.0/book/basics/structs_tuples_and_enums.html#enums) - define an enumeration
- [`enum`](/docs/book/src/basics/structs_tuples_and_enums.md) - define an enumeration
- `false` - Boolean false literal
- [`fn`](https://fuellabs.github.io/sway/master/book/basics/functions.html)- define a function or the function pointer type
- [`if`](https://fuellabs.github.io/sway/v0.44.0/book/basics/control_flow.html#if-expressions) - branch based on the result of a conditional expression
- [`fn`](/docs/book/src/basics/functions.md)- define a function or the function pointer type
- [`if`](/docs/book/src/basics/control_flow.md) - branch based on the result of a conditional expression
- `impl` - implement inherent or trait functionality
- `let` - bind a variable
- [`match`](https://fuellabs.github.io/sway/v0.44.0/book/basics/control_flow.html#match-expressions) - exhaustfully match a value to patterns
- [`match`](/docs/book/src/basics/control_flow.md) - exhaustfully match a value to patterns
- `mod` - define a module
- `mut` - denote mutability in references, or pattern bindings
- `pub` - denote public visibility of Sway data structures, traits, or modules
- `ref` - bind by reference
- `return` - return early from a function
- `Self` - a type alias for the type we are defining or implementing
- `self` - method subject
- [`struct`](https://fuellabs.github.io/sway/v0.44.0/book/basics/structs_tuples_and_enums.html#structs) - define a structure
- [`trait`](https://fuellabs.github.io/sway/master/book/advanced/traits.html#declaring-a-trait) - define a trait
- [`struct`](/docs/book/src/basics/structs_tuples_and_enums.md) - define a structure
- [`trait`](/docs/book/src/advanced/traits.md) - define a trait
- `true` - Boolean true literal
- [`type`](https://fuellabs.github.io/sway/master/book/advanced/advanced_types.html?search=#creating-type-synonyms-with-type-aliases) - define a type alias or associated type
- [`type`](/docs/book/src/advanced/generic_types.md) - define a type alias or associated type
- `use` - bring symbols into scope
- `where` - specifies traits for generic types
- [`while`](https://fuellabs.github.io/sway/v0.44.0/book/basics/control_flow.html#while) - loop conditionally based on the result of an expression
- [`while`](/docs/book/src/basics/control_flow.md) - loop conditionally based on the result of an expression

## [Keywords Reserved for Possible Future Use](#keywords-reserved-for-possible-future-use)
## Keywords Reserved for Possible Future Use

- `abstract`
- `async`
Expand All @@ -65,24 +65,24 @@ functionality described.
- `virtual`
- `yield`

## [Special Keywords](#special-keywords)
## Special Keywords

### [Program Keywords](#program-keywords)
### Program Keywords

Keywords associated with defining the type of Sway program to compile

- [`contract`](https://fuellabs.github.io/sway/master/book/sway-program-types/smart_contracts.html) - analogous to a deployed API with some database state
- [`library`](https://fuellabs.github.io/sway/master/book/sway-program-types/libraries.html) - Sway code that defines new common behavior
- [`predicate`](https://fuellabs.github.io/sway/master/book/sway-program-types/predicates.html) - programs that return a Boolean value and which represent ownership of some resource upon execution to true
- [`script`](https://fuellabs.github.io/sway/master/book/sway-program-types/scripts.html) - a runnable bytecode on the chain, which executes once to preform a task
- [`contract`](/docs/book/src/sway-program-types/smart_contracts.md) - analogous to a deployed API with some database state
- [`library`](/docs/book/src/sway-program-types/libraries.md) - Sway code that defines new common behavior
- [`predicate`](/docs/book/src/sway-program-types/predicates.md) - programs that return a Boolean value and which represent ownership of some resource upon execution to true
- [`script`](/docs/book/src/sway-program-types/scripts.md) - a runnable bytecode on the chain, which executes once to preform a task

### [Attribute Keywords](#attribute-keywords)
### Attribute Keywords

Keywords associated with defining the funcitonallity of attributes

- [`allow`](https://fuellabs.github.io/sway/master/book/reference/attributes.html#allow) - overrides checks that would otherwise result in errors or warnings
- [`doc`](https://fuellabs.github.io/sway/master/book/reference/attributes.html#doc) - specifies documentation
- [`inline`](https://fuellabs.github.io/sway/master/book/reference/attributes.html#inline) - suggests that a copy of the attributed function should be placed in the caller, rather than generating code to call the function where it is defined
- [`payable`](https://fuellabs.github.io/sway/master/book/reference/attributes.html#payable) - implies method is payable for compile time
- [`storage`](https://fuellabs.github.io/sway/master/book/reference/attributes.html#storage) - declaration that contains a list of stored variables
- [`test`](https://fuellabs.github.io/sway/master/book/reference/attributes.html#test) - marks a function to be executed as a test
- [`allow`](/docs/book/src/reference/attributes.md) - overrides checks that would otherwise result in errors or warnings
- [`doc`](/docs/book/src/reference/attributes.md) - specifies documentation
- [`inline`](/docs/book/src/reference/attributes.md) - suggests that a copy of the attributed function should be placed in the caller, rather than generating code to call the function where it is defined
- [`payable`](/docs/book/src/reference/attributes.md) - implies method is payable for compile time
- [`storage`](/docs/book/src/reference/attributes.md) - declaration that contains a list of stored variables
- [`test`](/docs/book/src/reference/attributes.md) - marks a function to be executed as a test

0 comments on commit 2ba270d

Please sign in to comment.