In Xcode 8.3.2 Swift 3.1, I have a UITableView where each row contains a label and a switch. I can manage the switches as a group (process the array), but what I would really like is to have a ValueChanged event fire in the parent UIViewController wh
I am trying to match a string within a switch block. The matching and branching part works fine, but I need a way to retrieve the capture groups on a match. Is there a way to do this at all? How? switch when str.match /f(o+)bar/ then something # I ne
LOGIN SYSTEM using Switch case i have problem with my source code for java if i input the right answer , it still repeat again and again please help meYou cannot compare strings with "!=" (in your while)
I've read quite a few answers on SO but can't seem to find a definitive answer as to why if break is omitted in this instance the case "C" will always be evaluated as true and the new array filled will only "G"'s. I clearly understand
I am trying to implement my own programing language in C++. When an error occours in my language (for example, during lexical analysis), an exception is thrown to be catched by the main function which then prints its message. The exception can be of
I have declared 4 images in the ViewDidLoad in my ViewController and then hide them with myImage1.hidden = YES;. I was wondering if there was anyway of sending a message from the App Delegate (from within a Switch Case) to the ViewController's ViewDi
I'm a C++ beginner. My problem is, if the user accidentally inputs a letter, the program will send the error message and it wont loop back. This is my code: #include <string> #include <iostream> using namespace std; int main() { int q; A: cout
I'm very new to PHP and I'm developing in the context of WordPress (with ACF). I'm creating a custom layout builder, I got it working but I want to make my code simpler. Right now is 14 cases which load a __.php file if is applicable. Here is an exam
How would I return the values that I found in this switch statement to the rest of the class for use (I want to use oneTotal, twoTotal, etc. out side of that switch statement)? Here is the code for the switch statement: switch(itemNo){ case 1: double
I've created a PHP code that checks the day of a month. Depending on the daynumber a different colorcode should be generated in my CSS. Today is the 8th January, so in this case the hex #FFD500 should be the value of background-color. Even though ech
I really like the structure of the switch statement compared to using multiple if else. However some times I want to use the switch statement and have the same value in multiple cases. Can this be done somehow? switch($fruit) { case 'apple': case 'or
I created jquery code for scroll website .it's worked but everytime it give default value of swich case. This is my html code <li> <a href="#" id="about">About</a> </li> <li> <a href="#" id=&q
I've got the following code: private static void createMenu(String nameOfMenu, Callable<Void> case1, Callable<Void> case2, Callable<Void> case3 ) throws Exception{ System.out.println(nameOfMenu+" Options"); System.out.println(&
I can't access my enum variables in my switch-case statement: public enum Country { FRANCE(0, "France"), SPAIN(1, "Spain"); private final int code; private final String name; Country(int code, String name) { // TODO Auto-generated cons
I'm trying to make a Desktop to Mobile switch for my website, but I can't really get it to work. This code (got it from internet) works, but it only redirect me to the mobile site... <?php $useragent=$_SERVER['HTTP_USER_AGENT']; if(preg_match('/(andr
I want to use switch in an android application. I tried it but main issue is if i have selected ON , it won't display off text. if i have selected OFF , it won't display on text. Off text is not displayed but we can select OFF by clicking in black ar
Given this method, does this represent some egregious stylistic or semantic faux pas: private double translateSlider(int sliderVal) { switch (sliderVal) { case 0: return 1.0; case 1: return .9; case 2: return .8; case 3: return .7; case 4: return .6;
I'm coding in c++ for the Nintendo DS, but this should be universal with all c++. I already know about switch statements, but I need to make a set of if, then, and else that have multiple arguments: void doSomething(int number) { ... } bool left = tr
--Let me add this. This code works for me the way it is. I just do not know why it works.-- I can't figure this out. switch ($_SERVER['QUERY_STRING']) { case isset($_GET['test0']): echo "test0<br>"; break; case isset($_GET['test1']): echo
I was practicing the other day and I came accross this error with a string for a switch: Cannot switch on a value of type String. Only int values or enum constants are permitted I'm not sure how I would fix this so I came here for help. I am using Ec
In my script (for Ruby >= 1.9) below I defined a Table class, which responsability is to generate 2 to 10 addition or multiplication table (chosen with a parameter). Then I call table method from a new Table instance in order to print result in a fil
I was just wondering if it was possible to have a variable case using the keyboard? So the cases can be any choice from a to z and its completely variable eg: only choices a),b) and c) appear in one condition bur in another a),b),c),d) and e) might a
According to MSDN, Visual C++ can emit C4062 warning when and enumeration is used in switch and there's no label for at least one element of that enumeration and there's no default: label in the switch Now to me such situation certainly deserves a wa
Using jQuery - I have I have 4 div's - div1, div2, div3 & div4 - that when rolled-over unique text and images are displayed into a separate div called div5, content will depend on what div you have rolled-over... I was thinking of using a switch stat
In a switch case, I've noticed that when I try to use a parameter as a case constant, I get a compilation error. But I can use fields/local vars. Is it really impossible to use a parameter as a case constant? Or are there exceptions (if so, please pr
I'm using code I found for a jquery style sheet switcher. From here: http://www.cssnewbie.com/simple-jquery-stylesheet-switcher/ Now I'm running into a problem using this switcher. I'm trying to us this to load a theme css file while keeping my main
Perl 5.10 introduced a proper switch construct with given/when and it seems like a powerful tool. Currently however, perldoc perlsyn lacks some good examples. One case where I found it handy lately was for using it with file test operators: given (-d
I love getting myself into these ridiculous situations where I over-evaluate my coding practices, so here goes! This question probably transcends PHP (as well as sanity). When evaluating a Boolean variable, which of these is best practice? (assume th
I am working on a form with datagridview and webbrowser controls. I have three columns as URL, username and password in datagridview. What I want to do is to automate the login for some websites that I use frequently. For that reason I am not sure if
A switch statement consists of "cases"... But is there any "else" case for all other cases? Have never found the answer to this... ex: switch ($var){ case "x": do stuff; break; case "y": do stuff; break; else: // TH