Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support procedural for loops #1434

Closed
liangyuanpeng opened this issue Jun 24, 2024 · 3 comments
Closed

Support procedural for loops #1434

liangyuanpeng opened this issue Jun 24, 2024 · 3 comments
Labels
question Further information is requested

Comments

@liangyuanpeng
Copy link
Contributor

Feature Request

Is your feature request related to a problem? Please describe:

Describe the feature you'd like:

I'm using kcl to generate configuration with docker-compose for etcd cluster, i want to set a param of cluster node count and then generate a cluster, and the kcl configuration like this:

for _i:=1;i<5;i++{
        _composeService+={...}
}

This is very helpful for quickly generating a docker-compose file for a stateful service cluster! and seems like it's not support now: https://www.kcl-lang.io/docs/next/user_docs/support/faq-kcl#46-procedural-for-loop

The case2 is dynamically generate kind cluster configuration files for multiple kind nodes. #1410

you can see that now i just use if count==3 / count ==5 for it (:

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

@Peefy
Copy link
Contributor

Peefy commented Jun 24, 2024

In the current version:

If you encounter specific code implementation issues, I can provide a more detailed sample code.

@Peefy Peefy added the question Further information is requested label Jun 24, 2024
@liangyuanpeng
Copy link
Contributor Author

liangyuanpeng commented Jun 24, 2024

Thanks for quickly reply and i will try the range on tomorrow, seems like it's what i want!

@liangyuanpeng
Copy link
Contributor Author

closing.. range is working for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants