mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 10:49:54 +00:00
feat: add Float!::{inc!, dec!}
This commit is contained in:
parent
a76ec165e7
commit
c76de00847
2 changed files with 34 additions and 0 deletions
|
@ -138,3 +138,9 @@ class FloatMut: # inherits Float
|
|||
|
||||
def update(self, f):
|
||||
self.value = Float(f(self.value))
|
||||
|
||||
def inc(self, value=1.0):
|
||||
self.value = Float(self.value + value)
|
||||
|
||||
def dec(self, value=1.0):
|
||||
self.value = Float(self.value - value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue