Click here to Skip to main content
14,836,361 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
Member 798912215-Sep-19 23:13
MemberMember 798912215-Sep-19 23:13 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
GuyThiebaut14-Sep-19 4:11
professionalGuyThiebaut14-Sep-19 4:11 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 4:15
mvahoney the codewitch14-Sep-19 4:15 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
lopatir14-Sep-19 4:22
Memberlopatir14-Sep-19 4:22 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 4:24
mvahoney the codewitch14-Sep-19 4:24 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
GuyThiebaut14-Sep-19 4:24
professionalGuyThiebaut14-Sep-19 4:24 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 4:26
mvahoney the codewitch14-Sep-19 4:26 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
Nand3214-Sep-19 4:25
MemberNand3214-Sep-19 4:25 
At times, the purpose of the search might be just to find the index of the valueToFind. Break keeps the index safe?

(JS)
var arr =[0,1,2,3,4,5];
var valueToFind = 3;

for(i=0;i<arr.length;i++) 
{
      if(arr[i]==valueToFind)
      {
	break;
      } 
}

console.log(i);
Then go on to calculate an offset or something from this index.


modified 14-Sep-19 11:38am.

GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 5:54
mvahoney the codewitch14-Sep-19 5:54 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
Sander Rossel14-Sep-19 5:11
professionalSander Rossel14-Sep-19 5:11 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 5:13
mvahoney the codewitch14-Sep-19 5:13 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
harold aptroot14-Sep-19 5:40
Memberharold aptroot14-Sep-19 5:40 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
Night Fox Localhost14-Sep-19 7:16
MemberNight Fox Localhost14-Sep-19 7:16 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
Gary R. Wheeler14-Sep-19 9:28
MemberGary R. Wheeler14-Sep-19 9:28 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 9:38
mvahoney the codewitch14-Sep-19 9:38 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
Gary R. Wheeler15-Sep-19 1:45
MemberGary R. Wheeler15-Sep-19 1:45 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch15-Sep-19 3:37
mvahoney the codewitch15-Sep-19 3:37 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
User 483504714-Sep-19 12:32
MemberUser 483504714-Sep-19 12:32 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 12:39
mvahoney the codewitch14-Sep-19 12:39 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
User 483504714-Sep-19 12:48
MemberUser 483504714-Sep-19 12:48 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 12:49
mvahoney the codewitch14-Sep-19 12:49 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
User 483504714-Sep-19 13:07
MemberUser 483504714-Sep-19 13:07 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 13:11
mvahoney the codewitch14-Sep-19 13:11 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
User 483504714-Sep-19 13:24
MemberUser 483504714-Sep-19 13:24 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 13:27
mvahoney the codewitch14-Sep-19 13:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.