Skip to content

Commit

Permalink
input now can have value!!
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonak-Adipta-Kalita committed Oct 16, 2022
1 parent 6c360c8 commit 193f947
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,22 @@ def execute_print_ret(self, exec_ctx):
execute_print_ret.arg_names = ["value"]

def execute_input(self, exec_ctx):
text = input()
text = input(str(exec_ctx.symbol_table.get("value")))
return RTResult().success(String(text))

execute_input.arg_names = []
execute_input.arg_names = ["value"]

def execute_input_int(self, exec_ctx):
while True:
text = input()
text = input(str(exec_ctx.symbol_table.get("value")))
try:
number = int(text)
break
except ValueError:
print(f"'{text}' must be an integer. Try again!")
return RTResult().success(Number(number))

execute_input_int.arg_names = []
execute_input_int.arg_names = ["value"]

def execute_clear(self, exec_ctx):
os.system("cls" if os.name == "nt" else "cls")
Expand Down

0 comments on commit 193f947

Please sign in to comment.