I wanted to control my servo with my switch from Arduino Cloud

Your code is not a complete sketch and looks awful
too much empty lines. improper indention

.
.
To learn about non-blocking timing