You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import "@stdlib/deploy"; // for Deployable trait
fun mapTest(): Int {
let m: map<Int, Cell> = emptyMap();
m.set(1, beginCell().storeUint(100, 16).endCell());
m.set(2, beginCell().storeUint(200, 16).endCell());
m.set(3, beginCell().storeUint(300, 16).endCell());
m.set(4, beginCell().storeUint(400, 16).endCell());
let sum: Int = 0;
foreach (k, v in m) {
let s: Slice = v.beginParse(); // convert Cell to Slice
sum += s.loadUint(16); // sum the Slice values
}
return sum; // 1000
}
contract ForeachExample with Deployable {
// notice the lack of explicit empty init() -- a feature of Tact 1.3.0
get fun mapTest(): Int {
return mapTest();
}
}
gives non-descriptive error message while building: Error while building. Removing the foreach loop runs the build. Additionally, local compilation of such code works too, with or without foreach.
The text was updated successfully, but these errors were encountered:
For example, the following:
gives non-descriptive error message while building:
Error while building
. Removing theforeach
loop runs the build. Additionally, local compilation of such code works too, with or without foreach.The text was updated successfully, but these errors were encountered: