I'm just looking at some VB.NET code and I came across this:
Dim var%
Later var
is set to 0.
What's the purpose of the percent sign (%
)?
(Google and SO search failed me)
The percent sign % (sometimes per cent sign in British English) is the symbol used to indicate a percentage, a number or ratio as a fraction of 100.
Variable Percentage means (x) if no Event of Default has occurred or is continuing, 72.5% or (y) if an Event of Default has occurred and is continuing, 70%.
The percent sign stands for "C/O", which means "Care Of." Care Of is just a part of a mailing address when you are addressing a letter to someone at someone else's house.
The % symbol in Python is called the Modulo Operator. It returns the remainder of dividing the left hand operand by right hand operand. It's used to get the remainder of a division problem.
Dim varname%
is ancient BASIC syntax for "varname
is an integer". This has been around for a very long time in the history of the BASIC family, and is supported in Visual Basic.NET (although I, personally, wouldn't recommend it - it can be rather opaque, as discovered by you).
It is shorthand for declaring "var" as of Type Integer, and has roots in the early, early days of BASIC (yes...old-school DOS BASIC).
So this:
Dim var%
is equivalent to:
Dim var As Integer
Here is the actual MS documentation: https://support.microsoft.com/en-us/kb/191713
% Integer
& Long
! Single
# Double
$ String
@ Currency
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With