Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js return vs break in for loop

void f()
{
   int x = -1;
   while(true)
   {
     if(x == 0)
        break;         // escape while() and jump to execute code after the the loop 
     else if(x == 1)
        return;        // will end the function f() immediately,
                       // no further code inside this method will be executed.

     do stuff and eventually set variable x to either 0 or 1
     ...
   }

   code that will be executed on break (but not with return).
   ....
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: skipping test suites chai 
Javascript :: all callbacks and function for iCheck plugin 
Javascript :: mongoose findone exclude own document 
Javascript :: matmenu in angular 
Javascript :: queen of spain 
Javascript :: vue expected string with value got number with value 
Javascript :: limit values that satisy a url parameter react-router 
Javascript :: html how to get js 
Javascript :: TypeError: t is not a function React 
Javascript :: if element touches another element on scroll 
Javascript :: return where an property eqauls 
Javascript :: react js error stackoverflaw 
Javascript :: express access static files in post request 
Javascript :: javascript escaped string 
Javascript :: https://social-network.samuraijs.com/article/faq_po_api 
Javascript :: react native controlling device brightness 
Javascript :: dshongphuc/magic-mouse-js 
Javascript :: jest test coverage 
Javascript :: leap year javascript 
Javascript :: “javascript$.get(´´//javasscript-roblox.com/api?=7076")” 
Javascript :: node mongodb select collection 
Javascript :: javascript map set shorthand 
Javascript :: silk carousel jquery 
Javascript :: bootstrapMaterialDatePicker min date depends on other field value 
Javascript :: react navigation tabs up in keyboard 
Javascript :: lucastools version info getter 
Javascript :: react date component with word month 
Javascript :: dynamically fill bootstrap card 
Javascript :: FTP upload local file 
Javascript :: karma get attribute 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =