im looking for examples of if else statements combined with try catch statements. im not finding much in my google searches
is such a thing legal?
Certainly. Both of those constructs can contain any other language elements inside the curly braces. For example:
try
{
if ($something) {
Do-Something
}
else
Do-SomethingElse
}
}
catch
{
# Handle error
}
# Or:
if ($something)
{
try
{
Do-Something
}
catch
{
# Handle error
}
}
else
{
try
{
Do-SomethingElse
}
catch
{
# Handle error
}
}
thank you…exactly what im looking for.