Skip to content

Use println() rather than print() #1056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2018
Merged

Use println() rather than print() #1056

merged 1 commit into from
May 14, 2018

Conversation

XD-DENG
Copy link
Contributor

@XD-DENG XD-DENG commented Apr 24, 2018

Hi there,

Not sure if there is any specific reason to use print() here, but it doesn't print out anything in the console of Scalafiddle. This may be confusing/misleading to beginners like myself.

So I would like to suggest to use println() here in the sample code, which can print properly, rather than print().

Please let me know your thought.

@@ -42,7 +42,7 @@ def foo(n: Int, v: Int) =

foo(10, 10) foreach {
case (i, j) =>
print(s"($i, $j) ") // prints (1, 9) (2, 8) (3, 7) (4, 6) (5, 5)
println(s"($i, $j) ") // prints (1, 9) (2, 8) (3, 7) (4, 6) (5, 5)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the output would be

(1, 9)
(2, 8)
(3, 7)
(4, 6)
(5, 5)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, but not sure the difference is worth the vertical space

@XD-DENG
Copy link
Contributor Author

XD-DENG commented May 14, 2018

Hi @SethTisue @MasseGuillaume should I close this PR? Please advise. Thanks.

@SethTisue SethTisue merged commit a94447c into scala:master May 14, 2018
@SethTisue
Copy link
Member

thanks @XD-DENG!

@XD-DENG
Copy link
Contributor Author

XD-DENG commented May 14, 2018

Thank you @SethTisue

@XD-DENG XD-DENG deleted the patch-1 branch May 14, 2018 10:11
bishabosha pushed a commit to bishabosha/docs.scala-lang that referenced this pull request Mar 21, 2022
Point the hacker guide to 2.13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants