시작하기무료로 시작하기

Signs of style

Scala is a hybrid imperative/functional language. Imperative-style Scala code often has the following traits:

  • One command at a time
  • Iterate with loops
  • Mutate shared state (e.g., mutating variables out of scope)

Functional-style Scala code often has the following traits:

  • Functions are used as first-class values
  • Operations of a program map input values to output values rather than change data in place

In this exercise, you'll categorize items as either a sign of imperative- or functional-style code. Knowing these signs now will inform the code you write in the future when you wish to utilize a certain style. The following definition may be helpful:

Side effect: code that modifies some variable outside of its local scope.

이 연습은 강의의 일부입니다

Introduction to Scala

강의 보기

실습형 인터랙티브 연습문제

이론을 실습으로 바꾸는 인터랙티브 연습 중 하나를 만나보세요

연습 시작