2017-05-30 5 views
1

ループ内の関数をどのように呼び出すのですか?私は関数を実行する無限ループを実行しようとしています。私はこのようなものを持っていますループ内の関数 - powershell

#Infinite loop to filter file 
while ($true){ 
    #run this function 
    filterFile 
} 


function filterFile{ 
    #do filtering of files here 
} 

function anotherFunction{ 
    #another function 
} 

もし私がそれを達成する方法があれば、それ以外の方法はありますか?

+3

ループの前に関数を移動しても問題ありません。 – TheMadTechnician

+0

それは素晴らしい作品です。私はあまりにも過度に思っていて、これを忘れてしまったと思う。ありがとう! – user7836693

答えて

1

「TheMadTechnician's」の答えを引用します。順序を変更すると、次のようになります。

function filterFile{ 
    #do filtering of files here 
} 

#Infinite loop to filter file 
while ($true){ 
    #run this function 
    filterFile 
} 
関連する問題