Skip to content

Commit 6035357

Browse files
committed
Added exit function
1 parent 6ec17db commit 6035357

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/pybuiltins/module/builtins_port.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,11 @@ def int_cast(obj: str) -> str:
5555

5656

5757
# noinspection PyShadowingBuiltins,PyUnusedLocal
58-
def pow(value: int, exponent: int) -> int:
58+
def exit_program(exit_code: int = 0) -> None:
5959
"""
60-
Calculates a number to the power of the given exponent.
60+
Terminates the program.
6161
62-
:param value: The base value.
63-
:param exponent: The exponent's value.
64-
:return: The power of the base to the exponent.
62+
:param exit_code: Returns this value as the status code.
6563
"""
6664

6765

@@ -103,9 +101,8 @@ def pow(value: int, exponent: int) -> int:
103101
code="return std::stoi(obj);",
104102
dependencies={"iostream"}
105103
),
106-
"pow": PyPortFunctionSignature(
107-
function=pow,
108-
code="return pow(value, exponent);",
109-
dependencies={"cmath"}
104+
"exit": PyPortFunctionSignature(
105+
function=exit_program,
106+
code="exit(exit_code);"
110107
)
111108
}

0 commit comments

Comments
 (0)