hello, linguist!

By Larissa Cury

October 19, 2022

Traditionally, the first thing one has to know when learning a new programming language is how to print hello, world!. This expression was first introduced in 1972, in Kernighan’s “The C Programming Language”. Nowadays, I’d say that printing it is almost an rite of passage to enter the programming world (which leaves us with many fun memes). You can learn more about its history here. That being said, this is how I came up with Hello, Linguist!, as a direct reference to Hello, World! 😉

Enough talking! Shall we practice a bit in R Studio and Google Chrome?!

R Studio:

Step 1: type print(“Hello, World!")
Step 2: press CTRL + Enter

print("Hello, World!")
## [1] "Hello, World!"

Step 3: Congrats!, this is your first code! 😁

Google Chrome:

Step 1: on a new Google Chrome tab, press “CTRL + SHIFT + j”, which will open the “Console”:

Step 2: type: alert(“Hello, world!") and press enter:

Step 3: Congrats! This is your first code! 😁

The print() function asks RStudio “please, show my string in the ‘console’”. In this case, our string is Hello, World. A string is a sequence of characters. Using Chrome, alert() will create an alert box showing what we’ve asked to be printed there.

Be it in RStudio or in Google Chrome, you may use print() and alert() to print any string! You may also play with numbers and letters, but be aware that the programs will understand anything that comes inside quotation marks as being part of the string. Take a look:

print("My name is Larissa, I was born in 1998!") # letters and numbers
## [1] "My name is Larissa, I was born in 1998!"
print("Linguistics & stats are fun!") # special characters
## [1] "Linguistics & stats are fun!"
print("Hello, linguistic!") # the classic string
## [1] "Hello, linguistic!"

Enjoy it!

🐕 Au-au! Today we learned about the expression “Hello, world!", which is, traditionally, the first line of code of any developer. We learned how to print it using RStudio’s print() function and using Google Chrome’s console with alert(). Now you may try to print other strings! See you soon!

Posted on:
October 19, 2022
Length:
2 minute read, 378 words
See Also: