mirror of
https://github.com/erg-lang/erg.git
synced 2025-12-23 05:36:48 +00:00
13 lines
252 B
Python
13 lines
252 B
Python
show s =
|
|
s.__str__()
|
|
|
|
assert show(1) == "1"
|
|
assert show(True) == "True"
|
|
# discard show((x,) -> x)
|
|
|
|
C = Class {x = Int}
|
|
C|C <: Show|.
|
|
__str__(ref(self)) = "<C object: x = \{self::x}>"
|
|
|
|
c = C.new {x = 1}
|
|
assert c.__str__() == "<C object: x = 1>"
|