From f1d02432a69b44b6bcf784892c332c9f47a829b3 Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Thu, 15 Nov 2018 12:02:38 +0100 Subject: Move undefined FAQ item --- docs/frequently-asked-questions.rst | 38 ------------------------------------- 1 file changed, 38 deletions(-) (limited to 'docs/frequently-asked-questions.rst') diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst index 8b655b0d..a569a896 100644 --- a/docs/frequently-asked-questions.rst +++ b/docs/frequently-asked-questions.rst @@ -143,44 +143,6 @@ arguments for you. See `ping.sol `_ and `pong.sol `_. -When returning a value of say ``uint`` type, is it possible to return an ``undefined`` or "null"-like value? -============================================================================================================ - -This is not possible, because all types use up the full value range. - -You have the option to ``throw`` on error, which will also revert the whole -transaction, which might be a good idea if you ran into an unexpected -situation. - -If you do not want to throw, you can return a pair:: - - pragma solidity >0.4.23 <0.6.0; - - contract C { - uint[] counters; - - function getCounter(uint index) - public - view - returns (uint counter, bool error) { - if (index >= counters.length) - return (0, true); - else - return (counters[index], false); - } - - function checkCounter(uint index) public view { - (uint counter, bool error) = getCounter(index); - if (error) { - // Handle the error - } else { - // Do something with counter. - require(counter > 7, "Invalid counter value"); - } - } - } - - Are comments included with deployed contracts and do they increase deployment gas? ================================================================================== -- cgit