M
Modular3mo ago
sazid

How to prevent compilation when parametric conditions fail?

struct Test[bits_count: Int64 = 10]:
@parameter
if bits_count < 0 or bits_count > 10:
raise Error("Invalid number of bits count.")
struct Test[bits_count: Int64 = 10]:
@parameter
if bits_count < 0 or bits_count > 10:
raise Error("Invalid number of bits count.")
With the above code, I can see that the error is being raised at runtime. Is it possible to stop the compilation with an error message when the parametric condition fails?
2 Replies
sazid
sazidOP3mo ago
thank you!
Want results from more Discord servers?
Add your server