How can I determine a variable's type in a vim function?

Blaine Kasten

Is there a way to check the type of a variable in vim? I need to check to make sure my functions argument is a number and am not sure how to go about it.

Ingo Karkat

You're looking for type(varname).

Note that explicit type checks are somewhat of a code smell (especially because the exact implicit type conversions done by Vim are not widely known); though I have to admit that sometimes they do make for a nice and short function interface.

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

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

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

How can I use the following formula to determine the value of a variable?

분류에서Dev

How can I determine the type of an argument passed in python

분류에서Dev

how can i determine the ACTUAL return type of a specific subclass of a generic superclass?

분류에서Dev

How can i save previous value of variable in Matlab Function

분류에서Dev

How can I get a consistent return type from this function?

분류에서Dev

How can I determine if a process is a system process?

분류에서Dev

How can I determine if Apache is installed on a system?

분류에서Dev

How can I determine state based on whether or not it's coming from a route param or a mutation?

분류에서Dev

How can I update vim to a newer version than 11.04's repo version (7.3.35)

분류에서Dev

How to correctly determine a type?

분류에서Dev

How can I get the type of a Type?

분류에서Dev

How can I determine what is causing an unwanted package to be built in Yocto?

분류에서Dev

How can I determine if NX is enabled on AMD A6?

분류에서Dev

How can I determine the original directory that an alias points to?

분류에서Dev

How can I programmatically determine the time a Gmail label was applied to a message?

분류에서Dev

How can I determine which Private PPAs are slowing down updates?

분류에서Dev

JQuery - How can I determine if a specific class has been Toggled?

분류에서Dev

How can I determine if all the values in an array are different, in Matlab

분류에서Dev

How can I determine if a latency is due to a driver or the scheduler?

분류에서Dev

How can I emulate key presses on Vim startup?

분류에서Dev

How can I use vim to view git diffs on Windows?

분류에서Dev

How can I create my own spelling file for vim?

분류에서Dev

How can I get a block cursor in Vim in the Cygwin terminal?

분류에서Dev

How can I discard my undo history in vim?

분류에서Dev

How can I get vim autocompletion working in iTerm

분류에서Dev

How can I Insert the result of a ".w" evaluation at the end of a line in Vim?

분류에서Dev

How can I copy/paste pattern the current line in vim

분류에서Dev

How can I get $_GET values to a variable

분류에서Dev

How can i use $_POST if the name is a variable?

Related 관련 기사

  1. 1

    How can I use the following formula to determine the value of a variable?

  2. 2

    How can I determine the type of an argument passed in python

  3. 3

    how can i determine the ACTUAL return type of a specific subclass of a generic superclass?

  4. 4

    How can i save previous value of variable in Matlab Function

  5. 5

    How can I get a consistent return type from this function?

  6. 6

    How can I determine if a process is a system process?

  7. 7

    How can I determine if Apache is installed on a system?

  8. 8

    How can I determine state based on whether or not it's coming from a route param or a mutation?

  9. 9

    How can I update vim to a newer version than 11.04's repo version (7.3.35)

  10. 10

    How to correctly determine a type?

  11. 11

    How can I get the type of a Type?

  12. 12

    How can I determine what is causing an unwanted package to be built in Yocto?

  13. 13

    How can I determine if NX is enabled on AMD A6?

  14. 14

    How can I determine the original directory that an alias points to?

  15. 15

    How can I programmatically determine the time a Gmail label was applied to a message?

  16. 16

    How can I determine which Private PPAs are slowing down updates?

  17. 17

    JQuery - How can I determine if a specific class has been Toggled?

  18. 18

    How can I determine if all the values in an array are different, in Matlab

  19. 19

    How can I determine if a latency is due to a driver or the scheduler?

  20. 20

    How can I emulate key presses on Vim startup?

  21. 21

    How can I use vim to view git diffs on Windows?

  22. 22

    How can I create my own spelling file for vim?

  23. 23

    How can I get a block cursor in Vim in the Cygwin terminal?

  24. 24

    How can I discard my undo history in vim?

  25. 25

    How can I get vim autocompletion working in iTerm

  26. 26

    How can I Insert the result of a ".w" evaluation at the end of a line in Vim?

  27. 27

    How can I copy/paste pattern the current line in vim

  28. 28

    How can I get $_GET values to a variable

  29. 29

    How can i use $_POST if the name is a variable?

뜨겁다태그

보관