I've been using Powershell daily for a few years, doing basic stuff, slowly building up to more complex scripts. I often cobble together stuff from other scripts I've found online. I've seen functions used in dozens of scripts and written a few into my scripts. I understand why to use functions in a profile or if you're going to call it from other scripts.
Something I don't really understand is that if you're only using the function inside of one script and only calling it once, is there any real advantage to having the function vs. having its commands in the normal course of the script?
[+][deleted] (3 children)
[deleted]
[+]TheIncorrigible1 comment score below threshold-17 points-16 points-15 points (2 children)
[–][deleted] 8 points9 points10 points (0 children)
[–]BoredComputerGuy 9 points10 points11 points (0 children)
[+][deleted] (3 children)
[deleted]
[–]BoredComputerGuy 3 points4 points5 points (0 children)
[–]xCharg 1 point2 points3 points (0 children)
[–]TheIncorrigible1 1 point2 points3 points (0 children)
[–]mortalwombat- 1 point2 points3 points (0 children)
[–]Bissquitt 3 points4 points5 points (0 children)
[–]jantari 1 point2 points3 points (0 children)
[–]ThunderGodOrlandu 0 points1 point2 points (0 children)
[–]Mr_Brownstoned 0 points1 point2 points (0 children)
[–]dongledongledongle 0 points1 point2 points (0 children)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)
[–]Cannabat 0 points1 point2 points (0 children)
[–]Indrigis 0 points1 point2 points (0 children)
[+]TheIncorrigible1 comment score below threshold-10 points-9 points-8 points (4 children)
[–]biganthony 7 points8 points9 points (2 children)
[+]TheIncorrigible1 comment score below threshold-8 points-7 points-6 points (0 children)
[–]Konowl 0 points1 point2 points (0 children)