How many years do you think it will take to write nearly 300 million cases
? Do you realize the impracticality of this? Even if it’s only a few thousand, it fits in the source code file that the compiler is able to process?
Unless you have a pattern that allows you to put this in a loop, which already eliminates the case
.
As the cat commented, if you have many, and by many understand a few tens or at most hundreds, you are doing something wrong. The compiler can handle it, and it handles thousands, but it doesn’t make sense to do that. Most likely this code looks better in computed form, using a loop or array (has some questions that speak of it in other languages here and here).
Don’t worry about it, the case
was not created to deal with this hypothetical situation, it becomes useless before the compiler chiar.
What language?
– gato
Visual Basic - NET
– Marcos Meireles
And what exactly do you want to know?
– gato
Limit the amount of "cases" in the project?
– Marcos Meireles
I don’t know if there is a case limit, you can use as many as you want. Of course, if you have too many it is a sign that you need to refactor the code.
– gato
My concern is to suddenly reach the limit the numbers of "cases". Because I don’t know much about programming and the simplest way I’ve learned is the above example.
– Marcos Meireles
I suggest you start around here then, to better understand the functioning of the
case
.– gato
This reply will also help in understanding the case.
– gato
The language limit is arbitrarily large, which corresponds to a maximum of an integer of 32 bits. Since it doesn’t make sense, because the maximum number of lines on file is 65,535 lines. But nobody passes it, after all.
– CypherPotato
@Marcosmeireles The answer solved your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site.
– Maniero