I’m looking for a way to do while-loops or for-loops in Miranda.
I’m trying to do something like
while(blablanotfinished)
{
if(a=true)blabla
else blabla
}
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.
Miranda doesn’t have while- or for-loops (which wouldn’t make much sense without mutable state anyway). In most cases you can use higher order functions instead. In cases where there is no higher-order function which does what you need, you can use recursion.
For example if you have the following while-loop in an imperative language:
You would express it recursively in Miranda like this: