+ 2

How can i stop this function?

https://code.sololearn.com/WhScSRUmCFdv/?ref=app I already tried to use this: If(n1 == 4 && n2 == 5 && n3 == 6){ break; } but in console shows: illegal break statemant. this code shows all possibilities between 1 and 6 using only 3 numbers, but i need It to stop in 4 5 6. sorry my English is very poor

15th Jul 2018, 7:01 AM
Felipe Medeiros
Felipe Medeiros - avatar
6 ответов
+ 2
Here is solution from what I think ur trying to do https://code.sololearn.com/WHLDOl2BkKem/?ref=app
15th Jul 2018, 8:00 AM
Yugabdh
Yugabdh - avatar
+ 3
"break;" only work for loop. Use "return;" for function instead. Edit: if you want to stop the execution of the interval and not the function only, use clearInterval() as in YUGABDH's answer
15th Jul 2018, 7:50 AM
Hoàng Nguyễn Văn
Hoàng Nguyễn Văn - avatar
+ 2
There are 20 possibilities, but i cant use combinations like 321 because to my porpose it is the same of 123. have you ever heard about "Megasena"? in my country we use this formula: P = t!/(n!*(t-n)!) where P = possibilities t = total of numbers n = numbers i can use with this formula I find how many combinations i can make
15th Jul 2018, 7:38 AM
Felipe Medeiros
Felipe Medeiros - avatar
+ 1
It cant repeat the number and i need it in order. I cant use 645 or 436 for exemple
15th Jul 2018, 7:23 AM
Felipe Medeiros
Felipe Medeiros - avatar
+ 1
thanks for helping me YUGABDH PASHTE
15th Jul 2018, 8:04 AM
Felipe Medeiros
Felipe Medeiros - avatar
0
Why 111 is not possible combination and some more like this
15th Jul 2018, 7:17 AM
Yugabdh
Yugabdh - avatar