Is it legit to pass variable data to a subroutine that is called using the Case statement as follows...
select case Action
case 1
Data = ([word}ReadAN4 * 2) Sub1 25, 60, 144, Data as wordcase 2 Data = ([word}ReadAN4 * 2)
Sub1 25, 60, 144, Data as word
case 3
Data = ([word}ReadAN4 * 3) Sub2 25, 60, 144, Data as wordcase 4 Data = ([word}ReadAN4 * 3)
Sub2 25, 60, 144, Data as word
end select
What are the limitations with Case? I can only find single line stuff when using case and wondered if this the only way to use case.
Thanks!!!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
... if action is 1, 2, 3 or 4 then all is good it will excute the case statements. Well.. nearly... 'Sub2 25, 60, 144, Data' is valid no need to define as a word... and if Data is dimensioned a word, then 'Data = ReadAD10 (AN4) * 2' is the correct method (with Dim Data as Word).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, just want to clean up code and need to know if you can pass variable data from the select case for one part of the program and then see if you can do the great than and less than thing from a select case for another part of the program.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is it legit to pass variable data to a subroutine that is called using the Case statement as follows...
What are the limitations with Case? I can only find single line stuff when using case and wondered if this the only way to use case.
Thanks!!!
... if action is 1, 2, 3 or 4 then all is good it will excute the case statements. Well.. nearly... 'Sub2 25, 60, 144, Data' is valid no need to define as a word... and if Data is dimensioned a word, then 'Data = ReadAD10 (AN4) * 2' is the correct method (with Dim Data as Word).
Multi - line statements are possible.
So multi line is good, how about passing varible data to a sub using the select case, are there any limitations there?
And can you do stuff like...
Last edit: viscomjim 2016-07-28
Changed your mind?
Yes.
No, just want to clean up code and need to know if you can pass variable data from the select case for one part of the program and then see if you can do the great than and less than thing from a select case for another part of the program.
Can you do multiple tests on the select case like this...
I am thinking ... a little bit of trial and error may help. Try these things, Add, some serial debug to see the results.
But, essentially .. yes.