Arduino in Indian Languages
  • Home
  • Download
  • Sign In
    • Sign In
    • Sign Up


goto = जाओ

Transfers program flow to a labeled point in the program. The use of goto is discouraged in C programming. With that said, there are instances where a goto statement can come in handy, and simplify coding. One of these situations is to break out of deeply nested for loops, or if logic blocks, on a certain condition.

Example

for(byte r = 0; r < 255; r++){
    for(byte g = 255; g > -1; g--){
        for(byte b = 0; b < 255; b++){
            if (analogRead(0) > 250){ goto bailout;}
            // more statements ... 
        }
    }
}
bailout: 
	

Have a suggestion for a better local language word for 'goto'?


Discuss