From fccdb59cef3d187adf232e2bd7e8bf4c9f577e38 Mon Sep 17 00:00:00 2001 From: newbateni Date: Tue, 27 Apr 2021 15:36:16 +0430 Subject: [PATCH] change variable declaration place in Test and TestPayable contract (in Fallback Function section) variables declared after their use and I fix that --- docs/contracts/functions.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/contracts/functions.rst b/docs/contracts/functions.rst index 10c2c9ed2..6f525a7b1 100644 --- a/docs/contracts/functions.rst +++ b/docs/contracts/functions.rst @@ -389,16 +389,18 @@ operations as long as there is enough gas passed on to it. pragma solidity >=0.6.2 <0.9.0; contract Test { + uint x; // This function is called for all messages sent to // this contract (there is no other function). // Sending Ether to this contract will cause an exception, // because the fallback function does not have the `payable` // modifier. fallback() external { x = 1; } - uint x; } contract TestPayable { + uint x; + uint y; // This function is called for all messages sent to // this contract, except plain Ether transfers // (there is no other function except the receive function). @@ -409,8 +411,6 @@ operations as long as there is enough gas passed on to it. // This function is called for plain Ether transfers, i.e. // for every call with empty calldata. receive() external payable { x = 2; y = msg.value; } - uint x; - uint y; } contract Caller {