Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8603747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:23:46+00:00 2026-06-12T02:23:46+00:00

I started learning Dart today, and I’ve come across something that my google skills

  • 0

I started learning Dart today, and I’ve come across something that my google skills are having trouble finding.

How do I have a fall-through in a non-empty case?

My use case is this: I’m writing a sprintf implementation (since dart doesn’t have this too), which would work except for this fall-through thing. When parsing the variable type you can, for example, have “%x” versus “%X” where the upper case type tells the formatter that the output is supposed to be uppercase.

The semi-pseudocode looks like:

bool is_upper = false;
switch (getType()) {
    case 'X':
      is_upper = true;
    case 'x':
      return formatHex(is_upper);
}

The other ways I can think of doing this, would one of the following

1:

switch (getType()) {
  case 'X': case 'x':
    return formatHex('X' == getType());
}

2:

var type = getType();
if (type in ['x', 'X']) {
   return formatHex('X' == getType());
}

Now, the second choice almost looks good, but then you have to remember that there are eleven cases, which would mean having eleven if (type in []), which is more typing that I’d like.

So, does dart have some // //$FALL-THROUGH$ that I don’t know about?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T02:23:47+00:00Added an answer on June 12, 2026 at 2:23 am

    The Dart specification gives a way for a switch case to continue to another switch case using “continue”:

    switch (x) {
      case 42: print("hello");
               continue world;
      case 37: print("goodbye");
               break;
      world:  // This is a label on the switch case.
      case 87: print("world");
    }
    

    It works in the VM, but sadly the dart2js switch implementation doesn’t yet support that feature.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just started learning PySide and is having problem with QTimer I have this #!/usr/bin/python
I started learning how to use Selenium today. I have never used it before.
I just started learning ASP.NET MVC4 today. After reading tutorials, downloading VS 2012, and
I have just started learning python version 3 and trying to create a file
I have only started learning python recently. I would still be considered a beginner.
I started learning LISP and I heard that there is some kind of a
I started learning vim today and installed it using sudo apt-get install vim Now,
I started learning C# a week ago. Today I was trying to install the
I started learning html recently, and one thing that really confused me is why
I started learning jQuery today and I'm facing an issue, I was under the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.