Skip to content

Commit

Permalink
Merge pull request #161 from radon-project/io-output-write
Browse files Browse the repository at this point in the history
fix: `io.Output.write` method.
  • Loading branch information
Almas-Ali authored Jun 1, 2024
2 parents fa4ffc0 + 73eb2bf commit 4a04afe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions examples/io-test.rn
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ print(str_val)
var password = io.Input.get_password("Enter a password: ")
print(password)

# issue here
var val = input("Enter a value: ")
io.Output.write(val)
io.Output.write(val, sep="\n")
11 changes: 6 additions & 5 deletions stdlib/io.rn
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ class Input {
}

class Output {
static fun write(...values, sep=" ", end="\n") {
var output = ""
for value in values {
output += str(value) + sep
static fun write(...values, sep=" ", end="\n") {
var ns = {
"values": values,
"sep": sep,
"end": end
}
print(output + end)
pyapi("print(*values, sep=sep, end=end)", ns)
}
}

0 comments on commit 4a04afe

Please sign in to comment.