# Multiple arguments to foreach loop

**URL:** <https://verificationacademy.com/forums/t/multiple-arguments-to-foreach-loop/37884>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, constraint-foreach-loop\
**Created:** [July 29, 2020, 6:42pm UTC](https://verificationacademy.com/forums/t/multiple-arguments-to-foreach-loop/37884 "2020-07-29T18:42:02Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [July 29, 2020, 8:51pm UTC](https://verificationacademy.com/forums/t/multiple-arguments-to-foreach-loop/37884/4 "2020-07-29T20:51:45Z")

</div>

_In reply to [DhavalP](https://verificationacademy.com/forums/t/multiple-arguments-to-foreach-loop/37884/3):_  
BTW, Please use [code tags](https://verificationacademy.com/forums/announcements/please-format-your-code-code-and/code-tags) making your code easier to read. I have added them for you.

You are getting the proper output for the constraints you wrote. It’s just that you didn’t write the proper constraint for the output you intended to see. ☺︎

Read [this](https://blogs.sw.siemens.com/verificationhorizons/2019/09/12/verilog-in-constraints/) and try:

```verilog
constraint x_y_width { foreach(x[i]) int’(x[i] + y[i]) < width;
                       width<15; }

```

---

_[View the full topic](https://verificationacademy.com/forums/t/multiple-arguments-to-foreach-loop/37884)._
