Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does a percentage symbol mean as part of a variable name?

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)

like image 681
Rowan Freeman Avatar asked May 09 '13 04:05

Rowan Freeman


People also ask

What does percentage symbol represent?

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.

What is a percentage variable?

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%.

What does a percent sign in front of name mean?

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.

What does the percentage symbol mean in Python?

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.


2 Answers

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).

like image 71
michaelb958--GoFundMonica Avatar answered Oct 23 '22 09:10

michaelb958--GoFundMonica


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
like image 35
Idle_Mind Avatar answered Oct 23 '22 09:10

Idle_Mind