Premium Essay

Variable Naming Rules

In: Computers and Technology

Submitted By anchapcy
Words 616
Pages 3
PT 1420
U2R1: Researching Variable Rules

The following rules should be observed when naming procedures, constants, variables, and arguments in a Visual Basic module: * A letter must be used as the first character. * A space, Period (.), exclamation mark (!), and the characters, @, &, #, cannot be used in the name. * 255 characters is the maximum amount of characters a name can contain. * Names should not generally be the same as functions, statements or methods. Keywords from the language end up being shadowed. To use an intrinsic (natural, or essential) language, function, statement that happens to conflict with an assigned name, it must be explicitly identified; one must precede the intrinsic command with the name of the associated type library. For example, if a variable is named, “function,” one must use “VBA.function,” to invoke the function used in a name. * Visual Basic isn't case-sensitive, but it preserves the capitalization in the statement where the name is declared.

When using Python the variable naming rules apply as such: * Must begin with a letter (a - z, A - B) or underscore (_) * Any other characters can be letters, numbers or _ * Case Sensitive. * Can be any (reasonable) length. There are some reserved words which you cannot use as a variable name because Python uses them. These words consist of: and, del, from, not, while, as, elif, global, or, with, assert, else, if, pass, yield, break, except, import, print, class, exec, in, raise, continue, finally, is, return, def, for, lambda, try. As every programming language has its own set of rules and conventions for the kinds of names that you're allowed to use, the Java programming language is no different. The rules and conventions for naming your variables can be summarized as follows: *...

Similar Documents

Free Essay

Researching Variable Naming Rules

...Assignment 1: Researching Variable Naming Rules Variable Naming Rules of Visual Basic * The first character must be a letter. * The usage of spaces, period (.), comma (,), Exclamation mark (!), or the characters @, &, $, # in the variable name are not allowed, but the underscore (_) is a valid character. * The name must be less than 256 characters in length. * You cannot use any names that are the identical as the functions, statements, and methods in Visual Basic. Variable Naming Rules of Python * The first character of the variable name must begin with a letter (a – z, A – Z), or an underscore (_). * The name can only consist of letters, numbers, and underscores (no special characters). * Variable names are case sensitive. * The variable name cannot be identical as a reserved name in Python due to the fact that Python uses them for other things. Variable Naming Rules of Java * Variable names are case sensitive. * A variable name can be any length as long as it is within the Unicode letter and digit standard, also you should use a letter as the first character of the variable word. You are allowed to use the dollar sign or underscore ($, _ ) as a first character but it isn’t recommended. * The only characters other than letters and number that can be used is the dollar sign and underscore (“$”, “_”), and no other special characters may be allowed. * If you are only using one word for the variable name it is advised......

Words: 702 - Pages: 3

Premium Essay

Pt1420 Researching Variable Naming Rules

...Just like any spoken language, rules must be followed in order to create effective communication between two people. For programming languages, it is necessary to follow all naming rules in order to build the program. Visual Basic’s variable name rules are as follows: Up to 255 characters, names must begin with a letter, no embedded spaces or special characters are to be used besides the underscore “__”, there cannot be a reserved word, uppercase and lowercase should be used with a purpose, and names cannot be repeated with the same level of scope (Visual Basic Naming Rules). If a developer does not follow these rules when using Visual Basic, there will be errors that may occur even before the program can be tested. Python Python is another common programming language, and was influenced by the design of ABC (Lukaszewski). In the 1996, Guido van Rossum created his very own version of ABCs, which we all know now as Python (Lukaszewski). Python is a basic syntax used for statement grouping, a list, strings, and numbers (Lukaszewski). Because it is another programming language, it also has its very own rules. Some rules are slightly different from Visual Basic, but all rules for Python are as follows: All names must begin with a letter or underscore, other characters can be letters, numbers or “__”, can be any (reasonable) length, it is case sensitive, and some reserved words cannot be used. Just like Visual Basic, not following these naming rules will result...

Words: 653 - Pages: 3

Premium Essay

Unit 2 Research Assignment

...2014 Researching Variable Naming Rules The variable naming rules for Visual Basic, Python, and Java have many different facets to them. These are the most common and most used programming languages in use today. Over the years these languages have become more user-friendly and easier to comprehend to write programs. Visual Basic is most used in introductory program writing and common for students’ first learning of programming. Some of the naming rules for Visual Basic are: the first character of the name must be a letter, you can’t use a space, period, exclamation point, or these special characters - &, @, $, or # in the name, the name cant’ exceed 255 characters in length, and Visual Basic isn't case-sensitive, but it preserves the capitalization in the statement where the name is declared. (Microsoft, 2014) Python provides a special process called the PEP process, short for Python Enhancement Process for changes proposed to Python. (University, 2014) Some of the naming rules for Python are as follows : indentation should be done using four spaces per indentation level, lines should be less than 80 characters as compared to Visual Basic and its use of a maximum of 255 characters, and lines that get too long should be aligned in a “reasonable” fashion, for example aligned with an open delimiter and at a different indentation level than any following indented suites. These are just some of the parameters to consider when naming in Python as......

Words: 625 - Pages: 3

Premium Essay

Visual Basic Naming Rules

...Visual Basic Naming Rules Use the following rules when you name procedures, constants, variables, and arguments in a Visual Basic module: •You must use a letter as the first character. •You can't use a space, period (.), exclamation mark (!), or the characters @, &, $, # in the name. •Name can't exceed 255 characters in length. •Generally, you shouldn't use any names that are the same as the functions, statements, and methods in Visual Basic. You end up shadowing the same keywords in the language. http://msdn.microsoft.com/en-us/library/office/ee440536(v=office.12).aspx Python Variable Naming Rules: 1. Must begin with a letter (a - z, A - B) or underscore (_). 2. Other characters can be letters, numbers or _ only. 3. Variable names are Case Sensitive. 4. There are some reserved words which we cannot use as a variable name because Python uses them for other things. These are: and,del,from,not,while,as,elif,global,or,with,assert,else,if,pass,yield,break,except,import,print,break,except,import,print,class,exec,in,raise,class,exec,in,raise,continue,finally,is,return,continue,finally,is,return,def,for,lambda and try. http://www.programr.com/python-variable-naming-rules General Naming Conventions for Java. Names representing packages should be in all lower case. Package naming convention used by Sun for the Java core packages. The initial package name representing the domain name must be in lower case. Names representing types must be nouns and......

Words: 723 - Pages: 3

Premium Essay

Rules of Programming Languages

...When dealing with the variable naming of Visual Basic, Python, and Java There are a few rules. When naming in Visual Basic, the name cannot exceed 255 characters in length. The name must contain a letter as the first character, and finally, the name cannot contain a; space, period, exclamation mark, dollar sign, or @, &, and # character in the name. When naming in Python all the characters and the name must begin with a letter or underscore. No other characters can be used. Variable names are Case Sensitive, and certain words are reserved. These words cannot be used as a variable name because Python utilizes these words them for other commands. Some of these reserved words are: and, del, from, not, while, as, elif, global, or, with, assert, else, if, pass, yield, break, except, import, print, break, except, import,
 print, class, exec, in, raise, class, exec, raise, continue, finally, is, return, continue, finally, is, return, def, for, lambda and try. Java also has variable language rules. First, a variable name must begin with a letter, underscore, or Unicode currency symbol, the initial character can be followed by any number of letters, numbers, underscore characters, and Unicode currency symbols. Also a variable name can’t contain spaces, and a query result is a type of variable, so it overwrites a local variable with the same name. Each language has similarities regarding variable naming. None of the discussed programs allow spaces in the name. Each language...

Words: 371 - Pages: 2

Premium Essay

Unit 2 Research Assignment

...the first programming language with an exemplary number of variable naming rules. The msdn.microsoft.com article explains the rules well. To start a word you must use a letter of the alphabet as the first character. You cannot use a space, nor a period, nor an exclamation mark, or the special characters of @ (at), & (and), $ (dollar sign), # (pound key) in the name. The name cannot surpass 255 characters in total length either. Names have to be precisely identified if the variable name is the same as an already existing one. You cannot repeat names in the same scope without the name being a different variable type. Lastly, while Visual Basic is not case-sensitive, it keeps the capitalization in the statement where the name is defined. Python is the next programming language where it gives you slightly more freedom for a variable name. A name must begin with a letter, lowercase or uppercase or an underscore. Python is case sensitive as well, consistency is important for read-ability. The variable name can be any “reasonable” length according to w3resource.com. Lastly, there are some reserved words Python uses for other things, which yourself cannot use. Java is the last of the three programming languages and no surprising exception to the naming rules. Names are case-sensitive, while you can begin a variable name with the $ sign or _ symbol, it is highly discouraged. The docs.oracle.com documentation of Java variable names tells the reader to always change an......

Words: 541 - Pages: 3

Premium Essay

Miss

...“The total amount is $ ” , total amount Unit 2 Research Assignment 1 The variable naming rules for VB are: o Must be one word, no spaces o Punctuation characters are avoided o The character cannot be a number o Name a variable something that indicates what may be stored in it o camelCase can be used Python Variable Naming Rules: o Must begin with a letter (a - z, A - B) or underscore (_). o Other characters can be letters, numbers or _ only. o Variable names are Case Sensitive. o There are some reserved words which we cannot use as a variable name because Python uses them for other things. These are :and,del,from,not,while,as,elif,global,or,with,assert,else,if,pass,yield,break,except,import,print,break,except,import, print,class,exec,in,raise,class,exec,in,raise,continue,finally,is,return,continue,finally,is,return,def,for,lambda . http://www.programmr.com/index.php?q=python-variable-naming-rules o Variable names are case-sensitive. A variable's name can be any legal identifier — an unlimited-length sequence of Unicode letters and digits, beginning with a letter, the dollar sign "$", or the underscore character "_". The convention, however, is to always begin your variable names with a letter, not "$" or "_". Additionally, the dollar sign character, by convention, is never used at all. You may find some situations where auto-generated names will contain the dollar sign, but your variable names should always avoid using it. A similar convention exists for the......

Words: 564 - Pages: 3

Free Essay

Differences Between C++ and Java

...Difference between C++ and JAVA:- 1. Java has no preprocessor. If you want to use classes in another library, you say Import and the name of the library. There are no preprocessors-like macros. 2. there are no pointers in the sense of C and C++. When you create an object with new, you get back a reference. 3. there are no destructors in Java. There is no “scope” of a variable per seen, to indicate when the object’s lifetime is ended-the lifetime of an object is determined instead by the garbage collection. 4. There is no GOTO statement in JAVA. 5. No INLINE methods. The java compiler might decide it’s own to inline a method, but you don’t have much control over this. You can suggest inlining in java by using FINAL keyword for a method. However , inline functions are only suggestions to the C++ compiler as well. 6. Java has method overloading that works virtually identically to C++ function overloading. 7. Java doesn’t create exe file after the execution of a program. 8. 9. > In Java, the sizes of int, long etc. are rigidly defined in terms of 10. > bits. In C++ they are platform−dependent. 11. > 12. > In Java, the JVM behaves at if it were big endian, even if internally 13. > it is actually little−endian. In C++, the endianness is platform 14. > dependent. 15. > 16. > In Java, garbage collection of unreferenced objects is automatic. In 17. > C++, you manually manage memory. 18. > 19. > In Java, references are constrained to point only to the beginnings......

Words: 1720 - Pages: 7

Free Essay

Bacon

...Variable or identifier is required to store data. One variable can store only one type of data. It can store only one value (data item) at a time. But, we can always change the value of the variable throughout the program without changing its data type. To store data (input, intermediate results, output), we need variables (or containers). To use variables in our program, we need to declare the variables: Variable declaration: 1. Choose the appropriate data type for the variable 2. Specify a legitimate and unique name for the variable. Naming rules for variables: 1. Must start with a letter or underscore( _ ) 2. Second and subsequent characters can be alpha numeric 3. Do not use any special characters or punctuation marks including space 4. Do not use any key words or reserved words for naming variables; Ex: String, integer, me, if, loop, else- you will see the key words in blue color. 5. Choose a name that reflects the content for the variable Examples: 1) A1 as the variable name: valid but does not reflect the content 2) 3TestScores - Not valid because it starts with a number midTermTestScore - camel casing convention is followed to name the variables. Capitalize the first letter of second and subsequent words in the variable's name. This is not syntax and the compiler does not give an error if camel casing is not followed. This is for our own reading and documentation purposes. Data types: 1. Numeric a. Integer Ex: 2, 5, -10, -21, 0 b.......

Words: 469 - Pages: 2

Premium Essay

Programming

...define a program’s structure. Formulate solution algorithms for calculations by properly following the order of operations. Assignment Requirements Answer: * Short Answer 1, 2, 3, and 4 on page 71 * Algorithm Workbench Review Questions 1 and 2 on page 71 * Programming Exercises Questions 1 and 4, starting on page 72 Required Resources Textbook Submission Requirements Submit your written answers to your instructor at the beginning of Unit 3. Unit 2 Research Assignment 1: Researching Variable Naming Rules Learning Objectives and Outcomes Determine program input, processing, and output stages. Create the necessary flowcharts to describe a program’s structure. Use pseudocode to define a program’s structure. Formulate solution algorithms for calculations by properly following the order of operations. Assignment Requirements Use the Internet and the ITT Tech Virtual Library to research the following questions: What are the variable naming rules of Visual Basic, Python, and Java? List three similarities and differences in between the three programming languages. Required Resources Textbook ITT Tech Virtual Library: http://library.itt-tech.edu Submission Requirements Submit your written answers to your instructor at the beginning of Unit 3. Labs Unit 2 Lab 2.1: Pseudocode Learning Objectives and Outcomes * Use pseudocode to define a program’s structure. * Formulate solution algorithms for calculations by properly......

Words: 450 - Pages: 2

Free Essay

Psychology

...range, variable are and be able to define and provide examples Know the syntax to declare a variable and set its data type -Dim VariableName as Variable type. All variable declarations start with dim. Examples of Variable type: string, double, integer For example: Dim City as String. What does this line of code do? Our variable is named City. The type of variable is String. It declares the name and type of the variable. Know all of the variable types and what kind of data they can store. Boolean (t/f), Double (real #s), Integer (whole numbers), String (text), Range, etc. Go back and look at the homework, step through the code, take the topics and look at an example Know the difference between writing to a spreadsheet and reading from the spreadsheet Range(“A2”).value = “itemCost” Value means we’re going to take cell A2 and make the value equal ItemCost. ItemCost is in quotation marks, so that means it is TEXT. And reading from the spreadsheet- ItemCost = Range(“A2”).Value In one, we’re putting data in, and the other (reading,) we’re setting itemcost equal to whatever the value was of A2. In writing, ItemCost is text. In the case of reading, ItemCost would be variable. Variables are used primarily to store data. Know the general syntax for If/Elseif/Else/then statements If condition 1 then Action 1 ElseIf Condition 2 then Action 2 Else Action 3 End if Where the Else represents the False statement Know that Range Names and Variable......

Words: 715 - Pages: 3

Free Essay

Sumbal

...Extension and Revision of the von Baeyer System for Naming Polycyclic Compounds (Including Bicyclic Compounds) (IUPAC Recommendations 1999) Synopsis, Preamble, VB-1 to VB-5 Contents of Section Synopsis Preamble VB-1 Definitions and Terminology VB-2 Main Ring VB-3 Naming Hydrocarbon Bicylic Systems VB-4 Numbering of Bicyclic Systems VB-5 Main Bridge References for this Section [pic] Synopsis These recommendations document the von Baeyer system for naming polycyclic ring systems described in Rules A-31, A-32 and B-14 of the Nomenclature of Organic Chemistry, Sections A, B, C, D, E, F and H, 1979 and R-2.4.2 of A Guide to IUPAC Nomenclature of Organic Compounds, 1993 and extend the system to cover more complex cases. It provides guidance on the naming of ring systems which previously the rules did not cover. The method is to identify the main ring and main bridge which provide the basic bicyclic system and to number these atoms. Then all further bridges, whether or not they include additional atoms, are identified by indicating not only the number of atoms but also the two atoms to which the bridge is attached. The final name also indicates the number of rings and the total number of skeletal atoms in the ring system. Heteroatoms, unsaturation and substituents are indicated in the usual way. Preamble This system of naming polycyclic compounds was first developed for bicyclic compounds by von Baeyer (ref 1) and was extended to tricyclic systems by Buchner and......

Words: 1366 - Pages: 6

Premium Essay

Its Making Put Something Here

...PT1420 Introduction to Programming Week-2 Lesson Plan TUE 6:00 PM to 10:30 PM Instructor: Tushar Patel (tspatel02@yahoo.com, tpatel@itt-tech.edu) CLASS: Topic: Unit 2: Software Program Design I Course Objectives Covered by This Unit CO2: Design programs by using flowcharts and pseudo code. CO3: Write programs that perform input, processing, and output. Unit Learning Outcomes LO8: Determine program input, processing, and output stages. LO9: Create the necessary flowcharts to describe a program’s structure. LO10: Use pseudocode to define a program’s structure. LO11: Formulate solution algorithms for calculations by properly following the order of operations. Key Concepts ▪ Determining input, process, and output ▪ Creating flowcharts and pseudocode ▪ Formulating algorithms Reading ▪ Gaddis, Chapter 2: “Introduction to Computers and Programming,” pages 29-55 Resources: • Data Projector • ITT Virtual Library • Text Books • Visual Studio • Lab Computers • Student Removable Hard Drive • VM Ware Player Methods: • Lecture • Group Discussion • Lab Work • Review exercise / Research Papers • Quiz Brief Lesson Overview: Today’s lecture we would be discussing the following topics. • Discuss how all programs basically consist of a three-step process: input, process, and output. Use the payroll calculation......

Words: 895 - Pages: 4

Premium Essay

Unit 2 Research Assignment

...Unit 2 Assignment: Research 1. What are the variable naming rules of Visual Basic, Python, and Java? * Visual Basic requires you to use a letter as your first character. You are unable to use spaces, periods, exclamation marks, and other special characters within the name, consisting of: @, &, $, #. The name also can’t exceed 255 characters. You can’t repeat the same names within the same level of scope. There’s also a few other minor rules to follow as well. * Python allows you to use either a letter or underscore character as the first character in a line. You can use an unlimited amount of letter, numbers, or underscore characters following that. Python is also case sensitive and therefore makes upper and lower case characters important. Any digit number will work including and between the numbers 0 through 9. * Java can use Unicode letters, digits, and two special characters such as an underscore and dollar sign. Java is also case sensitive. A variable’s name can be any legal identifier. The length of a variable name can also be any number. The beginning variable can consist of either letters or underscore characters. White space isn’t permitted, special characters aren’t allowed, and digits cannot be used at the start. Subsequent characters are able to be letters, digits, dollar signs, or underscore characters. Finally, variable names must not be a keyword or reserved word. 2. List three similarities and differences between the three......

Words: 337 - Pages: 2

Premium Essay

Student

... 1. What does a professional programmer usually do first to gain an understanding of a problem? The first thing that a professional programmer usually do first to gain an understanding of a program is to closely relate customer (Interview ) to inquire or gather information about the problem. 2. What two things must you normally specify in a variable declaration? The two things normally specified in a variable declaration are the variable type and identifier. 2. Algorithms / Pseudocode [1 point each, 5 points total] 1. Design an algorithm that prompts the user to enter his or her height and stores the user’s input in a variable named height. Declare height Display “Enter Your Height” Input Height Display “Height” 2. Write assignment statements that perform the following operations with the variables a and b. - Adds 2 to a and stores the result in b. - Subtracts 8 from b and stores the result in a Set b=2+a Set a=b-8 3. Write a pseudocode statement that declares the variable cost so it can hold real numbers. Floating Point-Variable 4. Write a pseudocode statement that assigns the value 27 to the variable count. Count:=27 5. If the following pseudocode were an actual program, what would it display? Declare Integer a = 5 Declare Integer b = 2 Declare Integer c = 3 Declare Integer result Set result = a + b * c Display result 11 3. Debugging Exercises [2 points each, 8 points...

Words: 1823 - Pages: 8