Use new style for the docs

This commit is contained in:
Denton Liu 2016-08-24 15:28:07 -04:00
parent f1e6bc2eaa
commit 532266b89e
4 changed files with 10 additions and 14 deletions

View File

@ -45,8 +45,7 @@ become the new richest.
richest = msg.sender; richest = msg.sender;
mostSent = msg.value; mostSent = msg.value;
return true; return true;
} } else {
else {
return false; return false;
} }
} }
@ -58,8 +57,7 @@ become the new richest.
pendingWithdrawals[msg.sender] = 0; pendingWithdrawals[msg.sender] = 0;
if (msg.sender.send(amount)) { if (msg.sender.send(amount)) {
return true; return true;
} } else {
else {
pendingWithdrawals[msg.sender] = amount; pendingWithdrawals[msg.sender] = amount;
return false; return false;
} }
@ -90,8 +88,7 @@ This is as opposed to the more intuitive sending pattern.
richest = msg.sender; richest = msg.sender;
mostSent = msg.value; mostSent = msg.value;
return true; return true;
} } else {
else {
return false; return false;
} }
} }

View File

@ -275,8 +275,7 @@ As a result, the following code is legal, despite being poorly written::
uint bar = 5; uint bar = 5;
if (true) { if (true) {
bar += baz; bar += baz;
} } else {
else {
uint baz = 10;// never executes uint baz = 10;// never executes
} }
return bar;// returns 5 return bar;// returns 5

View File

@ -461,16 +461,17 @@ If you do not want to throw, you can return a pair::
function getCounter(uint index) function getCounter(uint index)
returns (uint counter, bool error) { returns (uint counter, bool error) {
if (index >= counters.length) return (0, true); if (index >= counters.length)
else return (counters[index], false); return (0, true);
else
return (counters[index], false);
} }
function checkCounter(uint index) { function checkCounter(uint index) {
var (counter, error) = getCounter(index); var (counter, error) = getCounter(index);
if (error) { if (error) {
... ...
} } else {
else {
... ...
} }
} }

View File

@ -133,8 +133,7 @@ of votes.
// If the delegate already voted, // If the delegate already voted,
// directly add to the number of votes // directly add to the number of votes
proposals[delegate.vote].voteCount += sender.weight; proposals[delegate.vote].voteCount += sender.weight;
} } else {
else {
// If the delegate did not vote yet, // If the delegate did not vote yet,
// add to her weight. // add to her weight.
delegate.weight += sender.weight; delegate.weight += sender.weight;