select-case

Passing parameter as parameter in Fortran-90?

前提是你 提交于 2020-05-29 06:55:06
问题 Suppose I have a subroutine: subroutine foo(x, Nx) implicit none integer, intent(IN) :: x integer, intent(IN) :: Nx select case(x) case (1) write(*,*) "Minimum value" case (Nx) write(*,*) "Maximum value" case default write(*,*) "Somewhere in-between" end select end subroutine foo Suppose my driver looks like this: program main implicit none interface subroutine foo(x,Nx) integer, intent(IN) :: x integer, intent(IN) :: Nx end subroutine foo end interface integer, parameter :: Nx = 100 integer

Can you use .Contains(string) with a Select Case Statement?

喜欢而已 提交于 2019-12-29 05:47:07
问题 Is there anyway I can build a Select statement that uses the Contains function? Like this: Select commentStr Case commentStr.Contains("10") Case commentStr.Contains("15") 回答1: Select Case True Case commentStr.Contains("10") 'foo Case commentStr.Contains("15") 'bar End Select Note that with this construct, a maximum of one Case will be executed. (Also note that your C# friends can't do this with switch , which requires constant expressions in the case clauses :)) 来源: https://stackoverflow.com

Select Case on an object's type in VB.NET

不羁的心 提交于 2019-12-20 09:27:27
问题 I'm not sure if this valid C#, but hopefully you get the idea. :) switch (msg.GetType()) { case ClassA: // blah case ClassB: // blah 2 case ClassC: // blah 3 } How would I switch on an object's type but using VB.NET's Select Case ? I'm aware that some might suggest using polymorphism, but I'm using a hierarchy of small message classes so that really wouldn't work in my case. 回答1: With VB 2010, for projects targeting .NET framework 4 and later, you can now do this: Select Case msg.GetType()

MS Access VBA SQL query debugging select case

半城伤御伤魂 提交于 2019-12-20 07:40:03
问题 In MS Access 2013 VBA I get a syntax error in this SQL-string: strSQL = "INSERT INTO [man_year] ( man_year_val, year_int, main_research_area, organisation, man_year_source ) SELECT KU.[2007], '2007' AS Expr1, " _ & "select case right(left(KU.man_year_source;6);2) like 'Hu' 3 case right(left(KU.man_year_source;6);2) like 'Sa' 1 case right(left(KU.man_year_source;6);2) like 'Te' 2 case right(left(KU.man_year_source;6);2) like 'Su' 4 case right(left(KU.man_year_source;6);2) like 'Ud' 5 AS Expr2,

C# Switches vs. VB Case Statements

吃可爱长大的小学妹 提交于 2019-12-12 10:37:52
问题 I recently switched from VB to C#. One thing that I noticed was that in C#, I have problems using comparisons as part of the case. I am not sure how to explain it in words, so here is an example of what I am trying to do. In VB, my code looks like this and works perfectly fine. Select Case ExamScore Case Is >= 90 Grade = "A" Case Is >= 80 Grade = "B" Case Is >= 70 Grade = "C" Case Is >= 60 Grade = "D" Case Else Grade = "F" End Select In C# on the other hand, Visual Studio tells me that ">="

Excel VBA - Select multiple values to search a Case

和自甴很熟 提交于 2019-12-08 13:52:15
问题 I wrote a program that totals the number of times X number of widgets are tested in a day based upon a start and end count. After a period of time a widget will fail and have to be replaced, thus the count will start back at zero. I am using a Select Case to compute the data and a drop-down menu in Excel to select the widget(s). Everything works great besides one thing... I can't select multiple widgets to search the Case. I understand the general principles of the Case Statement - but is

Why should I use exit select?

[亡魂溺海] 提交于 2019-12-05 12:53:13
问题 Here are a couple of questions I gathered regarding exit select... Is there any reason for using exit select in VB.NET? Does the reason have anything to do with performance? Is the exit select equal to break; ? Example 1 Select case Name case "Mary" '... case "John" '... case else end select Example 2 Select case Name case "Mary" '... exit select case "John" '... exit select case else end select 回答1: It's not the same as using the break keyword with switch statements from C-like languages.

Why should I use exit select?

佐手、 提交于 2019-12-03 22:34:56
Here are a couple of questions I gathered regarding exit select... Is there any reason for using exit select in VB.NET? Does the reason have anything to do with performance? Is the exit select equal to break; ? Example 1 Select case Name case "Mary" '... case "John" '... case else end select Example 2 Select case Name case "Mary" '... exit select case "John" '... exit select case else end select It's not the same as using the break keyword with switch statements from C-like languages. With a switch , if you omit the break control it will fall through to the next case. With a Visual Basic

MS Access VBA SQL query debugging select case

99封情书 提交于 2019-12-02 12:54:20
In MS Access 2013 VBA I get a syntax error in this SQL-string: strSQL = "INSERT INTO [man_year] ( man_year_val, year_int, main_research_area, organisation, man_year_source ) SELECT KU.[2007], '2007' AS Expr1, " _ & "select case right(left(KU.man_year_source;6);2) like 'Hu' 3 case right(left(KU.man_year_source;6);2) like 'Sa' 1 case right(left(KU.man_year_source;6);2) like 'Te' 2 case right(left(KU.man_year_source;6);2) like 'Su' 4 case right(left(KU.man_year_source;6);2) like 'Ud' 5 AS Expr2, " _ & "4 AS Expr3, " _ & "select switch" _ & "(left(KU.man_year_source;3) like '1. '; 1;" _ & "left(KU

Can you use .Contains(string) with a Select Case Statement?

那年仲夏 提交于 2019-11-29 03:04:57
Is there anyway I can build a Select statement that uses the Contains function? Like this: Select commentStr Case commentStr.Contains("10") Case commentStr.Contains("15") Select Case True Case commentStr.Contains("10") 'foo Case commentStr.Contains("15") 'bar End Select Note that with this construct, a maximum of one Case will be executed. (Also note that your C# friends can't do this with switch , which requires constant expressions in the case clauses :)) 来源: https://stackoverflow.com/questions/2647771/can-you-use-containsstring-with-a-select-case-statement