docs.scala-lang icon indicating copy to clipboard operation
docs.scala-lang copied to clipboard

add explanation in book that indentation is significant

Open A-Roso opened this issue 3 years ago • 8 comments

There is no explanation in the book that indentation is significant and needed for the compiler. When searching for 'Indentation' it is only referenced in the Style Guide, Migration Guide and Language Reference. I think for new learners that start learning Scala with Scala3 and the Scala3 book, it would be very helpful to add a few lines of explanation e.g. in A Taste of Scala - Control Structures or even a chapter of its own, that indentation is significant and must be adhered to.

A-Roso avatar Dec 06 '21 16:12 A-Roso

@alvinj

SethTisue avatar Dec 06 '21 16:12 SethTisue

Hi @SethTisue. Unfortunately I have to focus on paid work at the moment, but yes, if we didn’t mention that, it should be added. I’ll be glad to do this as part of some volunteer work again next year, but honestly, it won’t be until somewhere around March-June.

alvinj avatar Dec 09 '21 00:12 alvinj

maybe someone else would like to pick this up.

SethTisue avatar Dec 09 '21 00:12 SethTisue

Hi @SethTisue, I am new here but would love to contribute to scala docs. can I be assigned to this issue?

Shorla avatar Mar 30 '22 21:03 Shorla

sure, go for it!

SethTisue avatar Mar 31 '22 05:03 SethTisue

should i move the explanation here:https://docs.scala-lang.org/style/indentation.html to scala book?

Shorla avatar Mar 31 '22 15:03 Shorla

should i move the explanation here:https://docs.scala-lang.org/style/indentation.html to scala book?

this explanation is for Scala 2, where indentation is only a style preference. You could adapt from the official reference for Scala 3's indentation (but it is not very beginner friendly)

bishabosha avatar Mar 31 '22 15:03 bishabosha

This is actually a pretty fundamental thing that I missed in the book. I agree with the initial comment that it could go in the Control Structures section, since that’s where it’s first shown, or just prior to that section.

FWIW, I also see on that Control Structures page that I left the Scala 2 example indented with four spaces, which is not consistent with the rest of the page.

alvinj avatar Apr 08 '22 00:04 alvinj