Skip to content

Commit

Permalink
Merge branch 'main' of github.com:onflow/cadence-lang.org into sainat…
Browse files Browse the repository at this point in the history
…i/access-all-formatting
  • Loading branch information
dsainati1 committed Dec 22, 2023
2 parents 4ed697b + 26c68e8 commit 0dbf7da
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions versioned_docs/version-1.0/language/functions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ and the function's return type.
The parameter types need to be enclosed in parentheses,
followed by a colon (`:`), and end with the return type.

Optionally, the `view` keyword can be included before the `fun` keyword to indicate that the type is that of a `view` function
Optionally, the `view` keyword can be included before the `fun` keyword to indicate that the type is that of a `view` function.

```cadence
// Declare a function named `add`, with the function type `fun(Int, Int): Int`.
Expand Down Expand Up @@ -491,18 +491,18 @@ Functions can be annotated as `view` to indicate that they do not modify any ext
A `view` annotation can be added to the beginning of a function declaration or expression like so:

```cadence
view access(all)
fun foo(): Void {}
access(all)
view fun foo(): Void {}
let x = view fun(): Void {}
access(all)
access(all)
struct S {
view access(all)
fun foo(): Void {}
view
init()
access(all)
view fun foo(): Void {}
view init()
}
```

Expand Down

0 comments on commit 0dbf7da

Please sign in to comment.