Skip to content
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

Update TermsAndTypes.scala #90

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/main/scala/scalatutorial/sections/TermsAndTypes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ object TermsAndTypes extends ScalaTutorialSection {
*
*/
def evaluation(res0: Int, res1: String): Unit = {
1 + 2 shouldBe res0
"Hello, " ++ "Scala!" shouldBe res1
1 + 2 shouldBe 3
"Hello, " ++ "Scala!" shouldBe "Hello, Scala!"
}

/**
Expand Down Expand Up @@ -126,8 +126,8 @@ object TermsAndTypes extends ScalaTutorialSection {
* upper case.
*/
def methods(res0: String, res1: Int): Unit = {
"Hello, Scala!".toUpperCase shouldBe res0
-42.abs shouldBe res1
"Hello, Scala!".toUpperCase shouldBe "HELLO, SCALA!"
-42.abs shouldBe 42
}

/**
Expand Down Expand Up @@ -167,7 +167,7 @@ object TermsAndTypes extends ScalaTutorialSection {
* different from `Int` and see the result:
*/
def staticTyping(res0: Int): Unit =
1 to res0
1 to true

/**
* = Common Types =
Expand All @@ -185,11 +185,11 @@ object TermsAndTypes extends ScalaTutorialSection {
* If you get stuck, try evaluating each statement in turn in a scala REPL to see what the result is.
*/
def moreMethods(res0: String, res1: Boolean, res2: String): Unit = {
16.toHexString shouldBe res0
16.toHexString shouldBe "16"
(0 to 10).contains(10) shouldBe true
(0 until 10).contains(10) shouldBe res1
(0 until 10).contains(10) shouldBe false
"foo".drop(1) shouldBe "oo"
"bar".take(2) shouldBe res2
"bar".take(2) shouldBe "r"
}

}