From fa36ea97342cfde2c84bd8818c71fd561735784c Mon Sep 17 00:00:00 2001 From: Daniel Sainati Date: Fri, 22 Dec 2023 13:46:30 -0500 Subject: [PATCH 1/2] Update versioned_docs/version-1.0/language/functions.mdx Co-authored-by: Supun Setunga --- versioned_docs/version-1.0/language/functions.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioned_docs/version-1.0/language/functions.mdx b/versioned_docs/version-1.0/language/functions.mdx index a47a79b..81458df 100644 --- a/versioned_docs/version-1.0/language/functions.mdx +++ b/versioned_docs/version-1.0/language/functions.mdx @@ -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`. From cae7c9a3f87b53672d04dd949f04b1d3684b4bd5 Mon Sep 17 00:00:00 2001 From: Daniel Sainati Date: Fri, 22 Dec 2023 13:46:43 -0500 Subject: [PATCH 2/2] Update versioned_docs/version-1.0/language/functions.mdx Co-authored-by: Supun Setunga --- versioned_docs/version-1.0/language/functions.mdx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/versioned_docs/version-1.0/language/functions.mdx b/versioned_docs/version-1.0/language/functions.mdx index 81458df..e951cfa 100644 --- a/versioned_docs/version-1.0/language/functions.mdx +++ b/versioned_docs/version-1.0/language/functions.mdx @@ -491,10 +491,17 @@ 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) struct S { - view access(all) fun foo(): Void {} + +access(all) +struct S { + + access(all) + view fun foo(): Void {} + view init() } ```