Symbolics with Control Flow

hello,
I’m trying to create a function with if condition using a symbolic var:

using Symbolics
@variables t
params = @parameters F

function f(t)
	if 0≤t<5
        return 1
	end

	if 5≤t<10
        return -1
	end
    
	return 0
end

Q = [F*f(t), 0]

The error is at `Q = [F*f(t), 0]’ :

ERROR: TypeError: non-boolean (Num) used in boolean context

How can I overcome this error?
thanks in ahead.

1 Like

Frequently Asked Questions · ModelingToolkit.jl? - " How do I handle if statements in my symbolic forms?"

thank you very much, that solved my issue.