×

Case Sensitive Languages

Every language, system, or program has the capability to differentiate between different case alphabets. If a programming language doesn’t work properly in upper case and lower case letters interchangeably, it is called as a case sensitive language. Other terms for it is case specific or case preserving languages. In case sensitive languages an error may be generated if there is some difference in the case type of any variable, function, or library or other things that may cause errors.

These case sensitive languages do discern between different names and queries, but if the case is not correct or there is some problem in it then it might not be able to provide the correct file or query. For example, if a user wants something like a book from a library then “Library” is entered by the user with a upper case L in ‘library’ the system might not recognize it as a stored file as there is a change in case and may also not give the expected result or even an error.

There is something opposite of case sensitive i.e. case insensitive, just as its name implies in case insensitive languages, there is no ability to differentiate between upper and lower case letters. Examples of case insensitive languages are ABAP, Ada, Fortran, Pascal, etc.

There are many case sensitive languages, some of them are as follows:

  • C
  • C++
  • C#
  • Java
  • Verilog
  • Ruby
  • Python
  • Swift etc.

Many more other languages are there that are case sensitive. In all these languages, there can be a wrong case if there is a file, library, function, variable, etc. that you have to call or use then it has to be written exactly as the programming language requires it. The compiler reads the code and if there is a problem in the case of anything then it gives syntax, or, runtime, error etc.

Let’s take an example, Java is a case sensitive language therefore the keywords, function names, variables, and other identifiers are to be typed with care and consistent capitalization. Now, for instance, when typing the “for” keyword, you must type "for", not "For" or "FOR". Just like this if there is a variable named study_hub, then it can be written in many ways such as “study_hub” , “Study_hub” or “Study_Hub” or even “STUDY_HUB”.

C language is also considered as a case sensitive language because any term like ‘new’ and ‘New’ are different in it. Just like C language, if a programming language is case sensitive then a program can have a wider range of functions and names, i.e. char can be used as a function and Char can be used for something else. But this increases the difficulty in programming for new developers. Due to there being confusion in the cases of the letters like there might an error due to this as they might not completely understand all the different functions, libraries, and other rules for variable naming, etc.

In order to write a code, the programmer needs deep knowledge to type it in the correct case otherwise, the incorrectly written code might alter the whole meaning of the code.

Program to show Case Sensitivity in C++ and Python:

First let’s check case sensitivity in a C++ program with a basic C++ program to print a sentence:

#include<iostream>
using namespace std;
int main(){
	Cout<<"Program to show case sensitivity in C++.";
return 0;	
} 

Output:

main.cpp: In function ‘intmain()’:
main.cpp:7:5: error: ‘Cout’ was not declared in this scope
    7 |     Cout<<"Program to show case sensitivity in C++.";
      |     ^~~~

Here, the cout() function is used with an uppercase ‘C’. Due to this, an error is generated. This can be corrected by writing the cout() function in the correct case, i.e. in lowercase cout(). This shows that C++ is a case sensitive language.

Now, let’s show the case sensitivity in the Python language by another basic output printing program in Python:

print("Program to show case sensitivity in the python language.")
Print("Hello")

Output:

Program to show case sensitivity in the python language.
Traceback (most recent call last):
  File "<string>", line 2, in <module>
NameError: name 'Print' is not defined. Did you mean: 'print'?
>

In this code, the first print() function is displayed as it is in the correct case whereas the second print() function displays an error in line 2. This shows that Python is also a case sensitive language.

All the other programming languages also work in similar ways with some variations according to their compilers.


Related Topics

What is Tray?

The tray is typically made of plastic and is powered by a small motor or a mechanism that pushes it out and pulls it back into the drive. The tray...

4 minutes read.

What is a Directory?

In computing, a directory is a virtual container in which a group of computer files and other subdirectories are stored, depending on their content, purpose, or any criteria decided by...

5 minutes read.

Are smartphones and tablets computers

The answer is yes. In modern times, at least a laptop /tablet /desktop /smartphone will be in a home. Because they play an important and vital role in everyone’s life...

4 minutes read.

Computer Fundamentals Tutorial

What is a Computer? "The computer is an electronic device that store, retrieve and process the data in binary form according to our need. It takes some input, process it, and...

10 minutes read.

How Much is 1 Byte, Kilobyte, Megabyte, Gigabyte, etc?

In this article, we will discuss some of the data-storing units, which are helping to store data in the memory of the device. They are all types of memory units...

6 minutes read.

What is NBSP (Non-Breaking Space)?

NBSP (Non-Breaking Space), also known as Hard space or Fixed space, is an HTML entity used to add blank spaces in the content. NBSP does not allow the browsers to...

7 minutes read.

My computer is running slow, what steps can i do to fix it?

It’s your time to work on your computer, and it just remains hanged, not letting you switch to other programs; in other words, your computer is in a state of...

4 minutes read.

Parts of Computers Names, Definitions and Images

Computer: A computer is an electronic device, which is made up of using various hardware. The computer processes data, performs calculations, and communicates with other devices and systems. Hardware refers...

14 minutes read.

What is Data?

In our daily life, you can see everybody is dealing with information and data to analyze things. Data can be of different forms and can be converted to the required...

6 minutes read.

What is Data Manipulation?

Data Manipulation is the process in which the developer organizes the data making it more understandable by properly arranging it in the proper structure. For example, you have gathered the...

9 minutes read.

What does ALT + Q do?

It is a useful shortcut that can open the ‘tell me’ box in recent versions of the Office software. The user has to press the Alt key while holding the...

4 minutes read.

What is a Slate PC?

Slate PCs are smaller versions of Tablet PCs with screen diagonals ranging from 7 to 12 inches. It has a desktop operating system and is an IBM PC-compatible computer. The...

4 minutes read.

How to use a computer keyboard

Alphanumeric, function, control, and arrow keys are on the keyboard. The left hand holds the "asdf" keys, while the right-hand holds the "jkl;" keys. To advance or switch between boxes,...

9 minutes read.

What are Storage Devices?

Computing hardware is capable of storing the information and can also be processed. Information on the storage can be stored permanently as well as temporarily. It is one of the core...

7 minutes read.

Who invented Computer?

Who invented Computer? I know this is the vert standard question which we have learned at standard 2. But, it’s not a surprise that most of the people fail to answer...

4 minutes read.

Low Level Language in Computer

Low Level Language: The computer languages are those languages by which the user can communicate with the machine. There are various types of programming languages via we can write the...

5 minutes read.

What does Alt+F do?

The computer is one of the most basic needs of every user. Without a computer we cannot do anything, almost in every field. In computer, there are many file menu options...

4 minutes read.

How to choose which items show in the notification area

Icons in the notification area, also known as the system tray, contain information for users about several features of their operating system. Examples include the date and time, the state...

3 minutes read.

What is a router?

A router allows the user to connect multiple packet-switched networks or subnetworks. It ensures the delivery of the data packet to the IP addresses they are assigned. We can use...

10 minutes read.

Case Sensitive Languages

Every language, system, or program has the capability to differentiate between different case alphabets. If a programming language doesn’t work properly in upper case and lower case letters interchangeably, it...

4 minutes read.