hi
is there any easier way to write this:
Not sure if easier, but I would type it like this.
switch (A) { case 1: case 2: case 3: case 4: case 5: // Do Something; break; default: break; }
if (A >= 1 && A <= 5 ) {Do Something;}
Not sure if easier, but I would type it like this.
Thank you my firend , actually I need to do it faster and shorter.
thank you ,
I didnt mean it .
let change my numbers: for axample 12,83,65 , 15.
its not about Continuous numbers.
There will be very little different in speed between the methods. Choose your preference.
Ok Thank you ,
So There is no better way ?
something like : if (A || 12, 83 , 65 , 15) // I know its not working but something like this,
I want a variable to be checked and if it was equal with one of the given amounts the condition become true.
Ok Thank you ,
So There is no better way ?
something like : if (A || 12, 83 , 65 , 15) // I know its not working but something like this,
I want a variable to be checked and if it was equal with one of the given amounts the condition become true.
'switch' and 'if-else' statements are your normal options.
You could write a function for it, but I don't see much benefit unless there are a lot of numbers and/or you call them in multiple places in your code.
It is just what is more comfortable for you to read and write... then the compiler will do whatever it needs to do.
'switch' and 'if-else' statements are your normal options.
You could write a function for it, but I don't see much benefit unless there are a lot of numbers and/or you call them in multiple places in your code.
It is just what is more comfortable for you to read and write... then the compiler will do whatever it needs to do.
Thank you much.
yes I think I must to writ a function for it.
dr.Rez: I didnt mean it .
|
|
|
Thank you very much.
There are somethings in your codes I must learn first to understand how it is work .
So I will use it after I learn the details .
and I did not understand this :
- There are no mind readers here.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi
is there any easier way to write this: