mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 20:34:44 +00:00
13 lines
249 B
Python
13 lines
249 B
Python
show s =
|
|
s.to_str()
|
|
|
|
assert show(1) == "1"
|
|
assert show(True) == "True"
|
|
# discard show((x,) -> x)
|
|
|
|
C = Class {x = Int}
|
|
C|C <: Show|.
|
|
to_str(ref(self)) = "<C object: x = \{self::x}>"
|
|
|
|
c = C.new {x = 1}
|
|
assert c.to_str() == "<C object: x = 1>"
|