# How to skip the error with try/catch statements?

**URL:** https://discourse.julialang.org/t/how-to-skip-the-error-with-try-catch-statements/65527
**Category:** General Usage
**Tags:** error, exception
**Created:** [July 29, 2021, 9:38pm UTC](https://discourse.julialang.org/t/how-to-skip-the-error-with-try-catch-statements/65527 "2021-07-29T21:38:02Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Sebastian\_Mena](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sebastian_mena/32/22819_2.png) [@Sebastian\_Mena](https://discourse.julialang.org/u/Sebastian_Mena)
#### Post date: [July 29, 2021, 9:38pm UTC](https://discourse.julialang.org/t/how-to-skip-the-error-with-try-catch-statements/65527/1 "2021-07-29T21:38:02Z")

</div>

Hi,

Do you know how to try with another option when first doesn’t work?  
For example:

```julia
try
var = first_option #this variable sometimes works, but in some cases throw an error

#so, when this var throw an error, I want to do other thing.
"other option":
var = second_option

```

In others words, i want try with an option, but if this option throw me an error, i want to do the second option, that I know its work. I hope you understand me.

---

<div class="post-metadata">

### Author: ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)
#### Post date: [July 30, 2021, 1:39am UTC](https://discourse.julialang.org/t/how-to-skip-the-error-with-try-catch-statements/65527/2 "2021-07-30T01:39:04Z")

</div>

```julia
var = try
   sqrt(-1)
catch
    1
end

```
