Posted On April 2, 2019

Explain Try and Catch Block

kimconnect 0 comments
blog.KimConnect.com >> Codes >> Explain Try and Catch Block
try {
Execute function X;
Execute function Y;
}
catch
{
Execute this when any function fails: X or Y;
}
finally
{
Execute function Z regardless whether X or Y fails;
}

# Note: if a “break,” “continue,” “return,” or “exit” command is triggered inside this block, the block will immediately get out of scope.

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Basic CSS: Use a CSS Class to Style an Element

<style>h2 {color: blue;}</style><h2>CatPhotoApp</h2><main><p>Click here to view more <a href="#">cat photos</a>.</p><a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange…

PowerShell: Creating Active Directory Accounts from CSV File

# User-input Variables $csvFile='C:\Users\rambo\Desktop\newUsers-finalized.csv' $newOu='CN=Users,DC=kimconnect,DC=com' $newCompany='KimConnect.com' $logFile="c:\temp\createActiveDirectoryAccounts-$(get-date -f yyyy-mm-dd-hh-mm-ss).txt" function createActiveDirectoryAccounts{ param( $csvFile, $newOu, $newCompany,…

PowerShell: Administering Network Time Protocol Settings on Windows

Quick Script of Domain Joined Laptops and Desktops for Remote Users: # Set Domain Joined…