This course has already ended.
You cannot submit this assignment

You need to sign in and enrol to submit exercises.

Assignment 26

4 points

Study the code below. The first line creates a vector. What does the rest of the code do?

val words = Vector("function", "method", "subprogram", "procedure", "routine")
var result = 0
for word <- words do
  if word.length > result then
    result = word.length
println(result)

Here we don’t loop through a buffer but a vector. The principle is just the same, though.

Please list all the different numbers that result stores during a run of the above program. Enter each number on a separate line, in order. Don’t repeat the same number. Remember to include the variable’s initial value.

Posting submission...

Earned points

0 / 4

Exercise info

Assignment category
Graded
Your submissions
0 / 5
Deadline
Wednesday, 11 October 2023, 18:00
Late submission deadline
Monday, 15 April 2024, 12:00 (-100%)
Group size
1-2
Total number of submitters
890