A function call is a small replay composition: the main script pauses while the function body produces a value, then the caller continues.

Program

Play the script to choose a request count and watch the replay jump into the function before returning to the caller.

function_step_replay.R
score_bonus <- function(count) {
    points <- count * 2
    points
}
request_count <- 
base_score <- 10
bonus <- score_bonus(request_count)
total <- base_score + bonus
label <- paste(request_count, total, sep = ":")
cat(label, "\n", sep = "")
score_bonus <- function(count) {
    points <- count * 2
    points
}
request_count <- 
base_score <- 10
bonus <- score_bonus(request_count)
total <- base_score + bonus
label <- paste(request_count, total, sep = ":")
cat(label, "\n", sep = "")
score_bonus <- function(count) {
    points <- count * 2
    points
}
request_count <- 
base_score <- 10
bonus <- score_bonus(request_count)
total <- base_score + bonus
label <- paste(request_count, total, sep = ":")
cat(label, "\n", sep = "")
function body The function body has its own local names while it is executing.
call jump The call line hands control to the function body and then receives the returned value.
single panel This is still one source panel with one ordered trace stream.