开始使用免费开始使用

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 ___ = ___(___ + ___,
              ___ + ___,
              ___ + ___)
编辑并运行代码