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

Splat unpacking

The splat operator ... is a powerful operator in Julia that can be used to unpack an iterable. This is a less cumbersome and cleaner way to quickly unpack an iterable, where you would otherwise need to use a loop.

In this example, use the splat operator to unpack a range to a vector instead of using a loop.

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

Intermediate Julia

ดูคอร์ส

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

  • Use the splat operator to unpack the range my_range to a vector.

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

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

# Unpack my_range using the splat operator
my_range = 0:10:50
println(____)
แก้ไขและรันโค้ด