เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

An array, all at once

In the previous exercises, you created and parameterized an array, then initialized it separately.

In this exercise, you'll experience performing all of these steps at once. The card variables you need are already defined.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Introduction to Scala

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Create an array named hands.
  • Initialize the first player's hand to tenClubs + fourDiamonds.
  • Initialize the second player's hand to nineSpades + nineHearts.
  • Initialize the third player's hand to twoClubs + threeSpades.

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

// Create, parameterize, and initialize an array for a round of Twenty-One
val ___ = ___(___ + ___,
              ___ + ___,
              ___ + ___)
แก้ไขและรันโค้ด