Missing condition in "elseif" at none

I got this error:

syntax: missing condition in "elseif" at none:13

for this code, what the mistake I made?

function triple_exponential_smoothing(series, slen, α, β, γ, n_preds)
    seasonals = initial_seasonal_components(series, slen)
    println("The seasonalities are: $seasonals")
    result = []
    smooth = 0.0
    trend = 0.0
    for i in (0:length(series) + n_preds)
        if i == 0 # iniial value
                smooth = series[1]
                trend = initial_trend(series, slen)
                println!("The initial_trend is: $trend")
                push!(result, series[1])
        elseif
            i >= length(series) # we are forecasting
                m = i - series.len() + 1
                push!(result, (smooth + m * trend) + seasonals[i % slen])
        else  # we are simulating history
                val = series[i]
                last_smooth = smooth
                smooth = α * (val - seasonals[i % slen]) +
                    (1.0 - α)*(smooth + trend)
                trend = β * (smooth - last_smooth) + (1.0 - β) * trend
                seasonals[i % slen] = γ * (val - smooth) +
                    (1.0 - γ) * seasonals[i % slen]
                push!(result, smooth + trend + seasonals[i % slen])
        end
    end
end

?elseif

1 Like

Did not get it, where to put it, I already used else as if nothing of the above, where to use elseif and what condition shall I put if I have nothing except the above?

I believe you cannot start a new line after elseif.

1 Like

Thanks a lot, this was the issue

IMHO, judging from your post history of past ~3days, docs should be a quicker solution for many of your questions. Or try Slack, in case you just need a pointer to a doc or some syntax correction.

1 Like