Is Call MagicFunction(intData1, intData2, Dim intData3) a valid statement in vbs?

Aj Godinez

I'm not really sure how to phase it any other way. The thing is, i'm trying to merge functions with the same name in vbs. Sometimes, the function appears in different forms in other parts of the system. If they are too different, I regretfully leave them as they are. However, if the differences are minor (like having one of the functions only having one variable more than the others, which i can then check for in-function), I'd like to add a variable that would be a stand in.

I already know that Optional variables are not possible in vbs, and I've already had experience with passing an array of variants (works like a charm), but I believe this case is a bit different.

Rafiki

Dim is not correct here. You can do for example:

Public Function MagicFunction(intData1, ByRef intData2, ByVal intData3)
    ' some code
End Function

and to call it:

MagicFunction 3, iCount, ""

to have "optional arguments", you can only use an array an parse it (for example using UBound(aTab) to select the correct case

Public Function MagicFunction(ByVal aTab)
    Select Case UBound(aTab)
        Case 1: MagicFunction1 aTab(1)
        Case 2: MagicFunction2 aTab(1), aTab(2)
        Case Else: MsgBox "function called with more than 2 args"  '<-- Should never go there
    End Select
End Function

With different version of your function depending on the number of argument, MagicFunction1, MagicFunction2... It's ugly but do the trick!

Another possibility is to use empty strings as argument, and define how your function ignore a part when the string is empty (or to be more accurate, call with a specific key, like "IGNORE_KEY")

I hope I'm answering your question!

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Call MagicFunction (intData1, intData2, Dim intData3)은 vbs에서 유효한 문입니까?

분류에서Dev

단순 행렬 곱셈은 "shapes (2,3) and (2,3) notalign : 3 (dim 1)! = 2 (dim 0)"?

분류에서Dev

numpy 배열을 (# dim1, # dim2, # channel)에서 (#channel, # dim1, # dim2)로 변경하는 방법

분류에서Dev

3 Dim을 2 Dim으로 변환하고 Ajust Class?

분류에서Dev

`*** RuntimeError : mat1 dim 1 must match mat2 dim 0` when I run model (images)

분류에서Dev

길이가 1 인 차원 중 하나가있는 Numpy 1-dim array vs 2-dim array

분류에서Dev

Pytorch nn. 선형 런타임 오류 : mat1 dim 1 must match mat2 dim 0

분류에서Dev

kmeans biplot에서 Dim1 및 Dim2에 사용되는 측정 값은 무엇입니까?

분류에서Dev

recurrent neural network ValueError : Found array with dim 3. 예상치 <= 2

분류에서Dev

2 Dim 배열 할당

분류에서Dev

Methods to sample a 2-dim curve efficiently

분류에서Dev

return valid json content after curl call

분류에서Dev

torch.sum ()에서 dim = -1 또는 -2는 무엇을 의미합니까?

분류에서Dev

RGB 그림에 대한 tf.nn.l2_normalize (x, dim, epsilon = 1e-12, name = None)의 올바른 dim 매개 변수

분류에서Dev

SWI-Prolog: Call 3=2+1 -> Fail: 3=2+1

분류에서Dev

How to get the row size of an 2 dim array in C

분류에서Dev

실패 : UsersSignupTest # test_valid_signup_information_with_account_activation 예상 : 1 실제 : 2

분류에서Dev

RNN, Keras, Python : 최소 최대 스케일러 데이터 정규화 ValueError : dim 3이있는 배열을 찾았습니다. 추정기 예상 <= 2

분류에서Dev

sklearn MinMaxScaler inverse_transform "Keras LSTM 블록 제거시"dim 3이있는 배열을 찾았습니다. Estimator 예상 <= 2 "

분류에서Dev

shape = (dim, L, 2) 인 ndarray의 액세스 요소

분류에서Dev

KSoap2 is not returning valid xml?

분류에서Dev

VBS를 사용하여 2 행렬 곱하기

분류에서Dev

N dim numpy 배열의 각 요소에 대해 1D numpy 배열에 추가하고 N + 1 dim 배열을 반환합니다.

분류에서Dev

vbs error end required

분류에서Dev

VBS If Variable> Variable Then

분류에서Dev

VBS 내의 SQLCMD

분류에서Dev

VBS CurrentDirectory 문제

분류에서Dev

C # 숫자의 오른쪽에 2dim 배열을 표시하는 방법

분류에서Dev

SSAS 및 SCD2-Dim에서 IsActive 행을 처리하는 방법

Related 관련 기사

  1. 1

    Call MagicFunction (intData1, intData2, Dim intData3)은 vbs에서 유효한 문입니까?

  2. 2

    단순 행렬 곱셈은 "shapes (2,3) and (2,3) notalign : 3 (dim 1)! = 2 (dim 0)"?

  3. 3

    numpy 배열을 (# dim1, # dim2, # channel)에서 (#channel, # dim1, # dim2)로 변경하는 방법

  4. 4

    3 Dim을 2 Dim으로 변환하고 Ajust Class?

  5. 5

    `*** RuntimeError : mat1 dim 1 must match mat2 dim 0` when I run model (images)

  6. 6

    길이가 1 인 차원 중 하나가있는 Numpy 1-dim array vs 2-dim array

  7. 7

    Pytorch nn. 선형 런타임 오류 : mat1 dim 1 must match mat2 dim 0

  8. 8

    kmeans biplot에서 Dim1 및 Dim2에 사용되는 측정 값은 무엇입니까?

  9. 9

    recurrent neural network ValueError : Found array with dim 3. 예상치 <= 2

  10. 10

    2 Dim 배열 할당

  11. 11

    Methods to sample a 2-dim curve efficiently

  12. 12

    return valid json content after curl call

  13. 13

    torch.sum ()에서 dim = -1 또는 -2는 무엇을 의미합니까?

  14. 14

    RGB 그림에 대한 tf.nn.l2_normalize (x, dim, epsilon = 1e-12, name = None)의 올바른 dim 매개 변수

  15. 15

    SWI-Prolog: Call 3=2+1 -> Fail: 3=2+1

  16. 16

    How to get the row size of an 2 dim array in C

  17. 17

    실패 : UsersSignupTest # test_valid_signup_information_with_account_activation 예상 : 1 실제 : 2

  18. 18

    RNN, Keras, Python : 최소 최대 스케일러 데이터 정규화 ValueError : dim 3이있는 배열을 찾았습니다. 추정기 예상 <= 2

  19. 19

    sklearn MinMaxScaler inverse_transform "Keras LSTM 블록 제거시"dim 3이있는 배열을 찾았습니다. Estimator 예상 <= 2 "

  20. 20

    shape = (dim, L, 2) 인 ndarray의 액세스 요소

  21. 21

    KSoap2 is not returning valid xml?

  22. 22

    VBS를 사용하여 2 행렬 곱하기

  23. 23

    N dim numpy 배열의 각 요소에 대해 1D numpy 배열에 추가하고 N + 1 dim 배열을 반환합니다.

  24. 24

    vbs error end required

  25. 25

    VBS If Variable> Variable Then

  26. 26

    VBS 내의 SQLCMD

  27. 27

    VBS CurrentDirectory 문제

  28. 28

    C # 숫자의 오른쪽에 2dim 배열을 표시하는 방법

  29. 29

    SSAS 및 SCD2-Dim에서 IsActive 행을 처리하는 방법

뜨겁다태그

보관