ModularM
Modular3y ago
1 reply
Jack

Adding repr implementation to print structs

Can you print out a struct like:
@value
struct MyPair:
    var first: Int
    var second: Int

    fn __repr__(self):
        print("first:", self.first)
        print("second:", self.second)

fn main():
    print(MyPair(2, 4))
Was this page helpful?