Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

fix: use +=, *=, -= operators #119

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/temp-archive/learn/wallet/wallet-2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,18 @@ contract Wallet {
require(msg.transfer.seqno == self.seqno, "Invalid seqno");

// Increment seqno
self.seqno = self.seqno + 1;
self.seqno += 1;

// Send message
send(SendParameters{value: msg.transfer.amount, to: msg.transfer.to, mode: msg.transfer.mode, body: msg.transfer.body});
}

receive(msg: Slice) {
self.seqno = self.seqno + 1;
self.seqno += 1;
}

receive("notify") {
self.seqno = self.seqno + 1;
self.seqno += 1;
}

receive("duplicate") {
Expand Down
6 changes: 3 additions & 3 deletions pages/book/cookbook.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ let sum: Int = 0;
let i: Int = 0;

repeat (10) { // repeat exactly 10 times
i = i + 1;
sum = sum + i;
i += 1;
sum += i;
}

```
Expand All @@ -75,7 +75,7 @@ repeat (10) { // repeat exactly 10 times
let i: Int = 0;

while (i < 10) {
i = i + 1;
i += 1;
}
```

Expand Down
2 changes: 1 addition & 1 deletion pages/book/exit-codes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Example:

```tact
repeat(10000) {
self.id = self.id + 1;
self.id += 1;
}
```

Expand Down
8 changes: 4 additions & 4 deletions pages/book/functions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ You can define global function anywhere in your program:
fun pow(a: Int, c: Int): Int {
let res: Int = 1;
repeat(c) {
res = res * a;
res *= a;
}
return res;
}
Expand All @@ -34,7 +34,7 @@ Extension functions allow you to implement extensions for any possible type.
extends fun pow(self: Int, c: Int) {
let res: Int = 1;
repeat(c) {
res = res * self;
res *= self;
}
return res;
}
Expand All @@ -48,7 +48,7 @@ Mutable functions are performing mutation of a value replacing it with an execut
extends mutates fun pow(self: Int, c: Int) {
let res: Int = 1;
repeat(c) {
res = res * self;
res *= self;
}
self = res;
}
Expand Down Expand Up @@ -80,7 +80,7 @@ contract Treasure {

// This means that this contract can receive the comment "Increment" and this function would be called for such messages
receive("Increment") {
self.counter = self.counter + 1;
self.counter += 1;
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion pages/book/types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ contract HelloWorld {
}

receive("increment") {
self.counter = self.counter + 1;
self.counter += 1;
}

get fun counter(): Int {
Expand Down
4 changes: 2 additions & 2 deletions pages/language/libs/dns.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ fun dnsExtractTopDomainLength(subdomain: Slice): Int {
let char: Int = subdomain.loadUint(8); // we do not check domain.length because it MUST contain \0 character
needBreak = char == 0;
if (!needBreak) {
i = i + 8;
i += 8;
}
} until (needBreak);
require(i != 0, "Invalid DNS name");
Expand Down Expand Up @@ -167,7 +167,7 @@ trait DNSResolver {
let delta: Int = 0;
if (subdomain.preloadUint(8) == 0) {
subdomain.loadUint(8); // Skip first byte
delta = delta + 8;
delta += 8;
}

// Checks correctness
Expand Down
Loading