Please tell me what is the difference between end and break? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please tell me what is the difference between end and break?

3rd Jan 2017, 1:47 PM
rahul sharma
rahul sharma - avatar
3 Answers
+ 2
Depends on the language, but take Ruby for example. In Ruby, the break keyword is used between switch cases and to break out of a loop prematurely. End is used as another way of writing curly braces essentially, marking the end of a block of code. They have very different uses in Ruby but again this depends on the language.
3rd Jan 2017, 2:14 PM
Lauren
0
i need for c++ language
3rd Jan 2017, 2:16 PM
rahul sharma
rahul sharma - avatar
0
@Lauren, break runs the same way in a majority of languages, end terminates run at the call point.
3rd Jan 2017, 5:12 PM
Louis Milotte
Louis Milotte - avatar