Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

labeled-statements

What is this : sign after a variable JS syntax?

December 2, 2023 by Tarik

Any JavaScript statement (kind-of except function declarations) can be preceded by a label: foo: var x = 0; What you’ve got there is something like that: $: doubled = 6 * 2; In your statement, “$” is the label. There’s not much point to labelled statements because there’s no goto in JavaScript. Both break and … Read more

Categories javascript Tags javascript, labeled-statements, svelte, syntax Leave a comment

is there a equivalent of Java’s labelled break in C# or a workaround

November 23, 2023 by Tarik

You can just use goto to jump directly to a label. while (somethingA) { // … while (somethingB) { if (condition) { goto label1; } } } label1: // … In C-like languages, goto often ends up cleaner for breaking nested loops, as opposed to keeping track of boolean variables and repeatedly checking them at … Read more

Categories c# Tags break, c++, labeled-statements Leave a comment

“loop:” in Java code. What is this, and why does it compile?

December 19, 2022 by Tarik

It is not a keyword it is a label. Usage: label1: for (; ; ) { label2: for (; ; ) { if (condition1) { // break outer loop break label1; } if (condition2) { // break inner loop break label2; } if (condition3) { // break inner loop break; } } } Documentation.

Categories java Tags java, labeled-statements Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa