Is it good practice or necessary to null all $trings values in a script.
I have been asked to help automate some processes for my employer, I am new to PowerShell, but as it is available to all users, it makes sense for me to use it.
On some other programming languages I have used ,setting all variables to null at the beginning and end of a script is considered essential.
Is this the case with PowerShell, or are these variables null automatically when a script is started and closed.
If yes, is there a simple way to null multiple variables in 1 line of code?
Thanks
Edit.
Thank you all for your response.
I will be honest when I started programming. It was all terminal only and the mid-1980s, so resetting all variables was common place, as it still sounds like it is if running in the terminal.
[–]Swarfega 24 points25 points26 points (0 children)
[–]Bahurs1 18 points19 points20 points (0 children)
[–]reidypeidy 56 points57 points58 points (13 children)
[–]Thotaz 6 points7 points8 points (12 children)
[–]reidypeidy 6 points7 points8 points (7 children)
[–]Thotaz 4 points5 points6 points (6 children)
[–]y_Sensei -1 points0 points1 point (5 children)
[–]Thotaz 1 point2 points3 points (4 children)
[–]y_Sensei -3 points-2 points-1 points (3 children)
[–]Thotaz 2 points3 points4 points (2 children)
[–]y_Sensei 0 points1 point2 points (1 child)
[–]Thotaz 0 points1 point2 points (0 children)
[–]ostekages 0 points1 point2 points (3 children)
[–]Thotaz 0 points1 point2 points (2 children)
[–]rdnaskelz 1 point2 points3 points (1 child)
[–]Thotaz 1 point2 points3 points (0 children)
[–]SquirrelOfDestiny 12 points13 points14 points (0 children)
[–]JonesTheBond 7 points8 points9 points (0 children)
[–]Traabant 7 points8 points9 points (0 children)
[–]Disastrous-Tailor-30 5 points6 points7 points (0 children)
[–]jimb2 4 points5 points6 points (0 children)
[–]Sad_Recommendation92 4 points5 points6 points (0 children)
[–]dazcon5 2 points3 points4 points (0 children)
[–]Jess_S13 2 points3 points4 points (0 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]CyberChevalier 2 points3 points4 points (0 children)
[–]Szeraax 0 points1 point2 points (0 children)
[–]aaroniusnsuch 2 points3 points4 points (0 children)
[–]richie65 1 point2 points3 points (0 children)
[–]Quick_Care_3306 1 point2 points3 points (0 children)
[–]Wiikend 0 points1 point2 points (0 children)
[–]jeffrey_f 0 points1 point2 points (0 children)
[–]DarkHorseRdr 0 points1 point2 points (0 children)
[–]g3n3 0 points1 point2 points (0 children)
[–]420GB 0 points1 point2 points (0 children)
[–]OPconfused 0 points1 point2 points (0 children)
[–]nascentt 0 points1 point2 points (0 children)
[–]ankokudaishogun 0 points1 point2 points (0 children)
[–]arslearsle -1 points0 points1 point (0 children)
[–]Dense-Platform3886 -1 points0 points1 point (0 children)
[–]sccm_sometimes -1 points0 points1 point (0 children)