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
I would expect that: cities.content() would return the Text of the cities Buffer.
Fine, it doesn't work, and Motoko is missing consistency.
However, this example fails to give any clue why, or what the work-around is. The error message gave no clue. Searching
the Web did not work for me (where I suspect it would have for most or all mature languages).
Just saying if there are logical exceptions like this, that seem arbitrary, that some clue should be given in the lessons, of course
we are adults, and should not be spoon-fed every response, but perhaps a link to the appropriate documentation, a warning, or
generalization about how to find alternative ways to arrive at text for a buffer.
import D "mo:base/Debug";
import Buffer "mo:base/Buffer";
// Create a buffer named cities with an initial capacity of 3.
let cities = Buffer.Buffer<Text>(3);
cities.add("London");
cities.add("Paris");
cities.add("Toyko");
cities.add("New York");
D.print("buffer size: " # debug_show(cities.size()));
D.print("buffer capacity: " # debug_show(cities.capacity()));
D.print("buffer content: " # debug_show(cities.toArray()));
The text was updated successfully, but these errors were encountered:
Problem:
I would expect that: cities.content() would return the Text of the cities Buffer.
Fine, it doesn't work, and Motoko is missing consistency.
However, this example fails to give any clue why, or what the work-around is. The error message gave no clue. Searching
the Web did not work for me (where I suspect it would have for most or all mature languages).
Just saying if there are logical exceptions like this, that seem arbitrary, that some clue should be given in the lessons, of course
we are adults, and should not be spoon-fed every response, but perhaps a link to the appropriate documentation, a warning, or
generalization about how to find alternative ways to arrive at text for a buffer.
The text was updated successfully, but these errors were encountered: