So I have such code that simulates function line (fn1, delay, fn2, delay, … fnN – calls a function, removes it from line sleeps a bit and so on).
I have faced strange problem – I see no delay. Why, what is wrong with my code?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your first problem is that you are calling
appendimmediately, rather than passing a function which will call append.should be
Even once you fix that, it’s not going to work properly however, the first will run but then all subsequent calls will simply find that
isRunningis true and not execute.In addition, as mentioned by @FelixKing in the comments:
is incorrect. You don’t want to pass a parameter to this function, just use val within it.