gzola
1
To know if is someone successful to use this sintax:
switch( answer )
{
case "Save" || "Substitute":
{
(omissis...)
}
break;
(omissis...)
}
or
switch( answer )
{
case "Save", "Substitute":
{
(omissis...)
}
break;
(omissis...)
}
Sometimes it work other time not
If it worked it would help to save a lot duplicate code.
patrick
2
I also have problems occasionally. A typical problem is for example if you retrieve a number from a text field and use this number like
var numberFromTextField = someTextField;
switch (numberFromTextField) {
case 1:
This never works. It does however work when using
if (numberFromTextField == 1)
gzola:
To know if is someone successful to use this sintax:
switch( answer )
{
case “Save” || “Substitute”:
{
(omissis…)
}
break;
(omissis…)
}
or
switch( answer )
{
case “Save”, “Substitute”:
{
(omissis…)
}
break;
(omissis…)
}
Sometimes it work other time not
If it worked it would help to save a lot duplicate code.
Both your examples didn’t work right for me (at least, in the past). The shortest and working option I’m using is:
switch( answer )
{
case "Save":
case "Substitute":
{
(omissis...)
}
break;
(omissis...)
}