PowerShell 7 Yeni Ozellikler – Null condition operators – Null deger kontrolu

Null condition operators – Null deger kontrolu

Bir degiskenin $null degere sahip olmadigini pipeline icinde kontrol etmeye yarar.

Asagidaki ornekte $degisken isimli degiskenin degerini once $null olarak belirliyoruz. Sonra, $degisken isimli degiskenin degerinin $null oliup olmadigini “??” ile kontrol ettiriyoruz. Son ornekte ise, eger $degisken isimli degiskenin degeri $null degerine esitse o zaman ona deger olarak “yeni deger” degerini atiyoruz. Bunu da ‘??=”yeni deger”’ ile yapiyoruz.

Yani ozetle, herhangi bir degiskenin icinde null deger bulunup bulunmadigini tek satirda “??” kullanarak yapabilir, yine ayni satirda dilerseniz null degree sahip degiskenlere “??=” kullanarak deger atayabilirsiniz.

Yazıyı Paylaş! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • Technorati
  • Twitter
BakiOnur ()

Microsoft Most Valuable Professional (MVP 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, Current) Towershell.com Founder clouderz.com Founder Microsoft Certified Trainer (13 years in a row, current) Onur has been working in IT arena with more than 15 years of experience specifically in Windows Server, Exchange Server and Powershell and for the past 5 years in Cloud Technologies including Office 365, Azure and so on. He's authored Windows Server books and written more than 400 technical articles published on several communities. Some of his hundreds of Powershell tools and scripts has been published on Microsoft Script Center. Onur is also a 10-year MCT who has delivered more than 10.000 hours of training in Microsoft technologies. He has been to over 70 universities and presented several Microsoft technologies with highlighted topics. He graduated from Okan University Graduate School in Computer Engineering. He lives in London and is currently running his own business at Clouderz Ltd.

Sosyal Medya

Visit Us On TwitterVisit Us On FacebookVisit Us On Linkedin
@BakiOnur 'u Takip Et

MVP Profili



Soru ve Önerileriniz

[si-contact-form form='1']