mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-02 21:44:34 +00:00
Rename dir: compiler
-> crates
This commit is contained in:
parent
e1004b538d
commit
a127564b31
221 changed files with 17 additions and 19 deletions
17
crates/erg_compiler/lib/std/_erg_bool.py
Normal file
17
crates/erg_compiler/lib/std/_erg_bool.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
from _erg_nat import Nat
|
||||
from _erg_result import Error
|
||||
|
||||
class Bool(Nat):
|
||||
def try_new(b: bool): # -> Result[Nat]
|
||||
if b == True or b == False:
|
||||
return Bool(b)
|
||||
else:
|
||||
return Error("Bool can't be other than True or False")
|
||||
|
||||
def __str__(self) -> str:
|
||||
if self:
|
||||
return "True"
|
||||
else:
|
||||
return "False"
|
||||
def __repr__(self) -> str:
|
||||
return self.__str__()
|
Loading…
Add table
Add a link
Reference in a new issue