lpython
lpython copied to clipboard
Add space between multiple strings while printing
fixes #2669
print("a", "b", "c", "d")
fruits: list[str] = ["apple", "guava", "mango"]
mango: str = fruits.pop()
print("I have got a", mango, "to eat!")
(base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py
a b c d
I have got a mango to eat!
@Shaikh-Ubaid could you please rerun the CI? The failing check is unrelated to the PR.
The approach in this PR might break lfortran. lfortran needs to not print spaces when two consecutive print arguments are strings.
% cat examples/expr2.f90
program expr2
implicit none
print *, "hi", "bye"
print *, 12, 23
end program
% gfortran examples/expr2.f90
% ./a.out
hibye
12 23
% lfortran examples/expr2.f90
hibye
12 23