Questions tagged [fall-through]

Use fall-through to refer to an idiom where a multi-way branch statement (such as a switch statement in C) intentionally enters the next branch after completing the current one (falling through to the next case).

45 questions
1
vote
0 answers

Transparent view w/ GestureListener does not let touch fall through

My Intention: To listen for any user-input on any activity, irrelevant of what type of gesture or touch event it was. My Attempted Solution Created a custom view that's transparent, using TYPE_SYSTEM_ALERT so it's always on top, along with other…
1
vote
1 answer

Prevent touch fall through on mobile safari using twitter bootstrap submenu

I am working on a webpage that uses twitter bootstrap to create dropdown menus with submenus. Everything is working fine on a desktop browser, but when I open it up in mobile safari on the iPad I run into issues. If there is an input of any kind…
mtmurdock
  • 12,756
  • 21
  • 65
  • 108
0
votes
1 answer

Command fall through in lex

I'm using lex in my program and I've run into a problem I need some help with. My program accepts its input in the form of [something " something]. This is working correctly. However, I also need to accept the form [something"something]. Is there a…
samoz
  • 56,849
  • 55
  • 141
  • 195
0
votes
1 answer

Is it possible in Haskell to write the catch-all pattern first? Or use "negative" pattern?

Sometimes, if one the pattern rules need some special rhs which is made more readable via where, I end up with something like this data D = A | B | C func :: D -> b func A = special_case where special_case = other helper other = aaaa …
Enlico
  • 23,259
  • 6
  • 48
  • 102
0
votes
0 answers

Switch object type fallthrough with either identical variable name or null checking?

So we can do a fallthrough on switch statements and we can do switch statements on object type but is there a way to do a fallthrough on object types so that we can say "If it's any of these types of objects, call this method, pass in the object and…
user4593252
  • 3,496
  • 6
  • 29
  • 55
0
votes
1 answer

Programming Novice - C - Issue with Fall-through in Menu System

I have recently begun studying C just for the fun of it and I decided to have a go at creating a menu system, but I'm having an issue with what I think is fall-through: #include int main (void) { int x, y, z; start: printf ("Menu 1 --…
0
votes
2 answers

How to fallthrough to a specific case in switch statement

In my first section I show different style UIAlertController based on the row. Second section does unrelated stuff. In order to avoid code duplication in both cases, how do I fallthrough to a specific case in switch statement? Is this possible in…
osrl
  • 8,168
  • 8
  • 36
  • 57
0
votes
1 answer

Fallthrough issue in Javascript switch statement

I have a large array of features with p and u properties. I want to find the smallest and highest p and u in the array and create this switch statement in a loop. This works about 99.9% of the time. However. I have one data set where the max and min…
Dennis Bauszus
  • 1,624
  • 2
  • 19
  • 44
0
votes
1 answer

Why do fall through Switch cases compile in c#

As we all know switch cases in c# do not allow you to fall through according the MSDN Execution of the statement list in the selected switch section begins with the first statement and proceeds through the statement list, typically until a jump…
johnny 5
  • 19,893
  • 50
  • 121
  • 195
-1
votes
4 answers

Proper condition loop

How should I specify my if-else-elif statements to not let them finish checking conditions after the first if-clause? import random x = random.randint(1, 100) correct_answer = False guess_count = 0 answer = input("Try to guess a number in range of 1…
MaciejGy
  • 31
  • 2
-1
votes
1 answer

unexpected fall to if statement

HTML
v
Javascript function highlight_word() { var cursor = document.getElementById(area + '_cursor'), pe = cursor.previousElementSibling, ne =…
Sanmveg saini
  • 744
  • 1
  • 7
  • 22
-2
votes
1 answer

Switch statement fall-through in Java?

Can I use the goto or fall-through in a Switch statement in Java like you can in C#? Here is an example of the code I modified in C# in order to use the goto statement in a conditional Switch, pay attention where it says SAM: // add 1 to…
S. Mayol
  • 2,565
  • 2
  • 27
  • 34
-2
votes
2 answers

Fall-through Switch Case with For Loop PHP

Please help. for($i=0; $i<12; $i++ ){ switch($i) { case 0: case 1: case 2: case 3: case 4: echo ("i is less than 5
"); break; case…
Helen Andrew
  • 87
  • 1
  • 2
  • 12
-2
votes
2 answers

looping a switch statement in C# has strange error

I'm recently learning C# but I've run into a problem. public static void PlayGame(Kion Player1,Kion Player2) { bool Win = false; Console.WriteLine ("Let us begin then"); Console.WriteLine ("Press Enter to roll the dice…
ParityB1t
  • 77
  • 4
-4
votes
1 answer

Don't understand the output of program with a switch block

I want to understand the output of this code, specifically the 2 last lines of the output (lines 4 and 5). #include #include int main() { double x = 2.1; while (x * x <= 50) { switch ((int) x) { …
1 2
3