DEV Community

Medea
Medea

Posted on

Variables in languages

There's been many posts about how to say Hello World in different programming languages, but is there many about variables?
Well this post will tell you about how to declare variables (specifically a string) in different programming languages.


  • Python
variable = "Hello World!"
Enter fullscreen mode Exit fullscreen mode
  • JavaScript
var variable = "Hello World!"
Enter fullscreen mode Exit fullscreen mode
  • Java
String variable = "Hello World!"
Enter fullscreen mode Exit fullscreen mode
  • C++
string variable = "Hello World!"
Enter fullscreen mode Exit fullscreen mode
  • PHP
$variable = "Hello World!"
Enter fullscreen mode Exit fullscreen mode
  • C#
string variable = "Hello World!"
Enter fullscreen mode Exit fullscreen mode
  • R
variable <- "Hello World!"
Enter fullscreen mode Exit fullscreen mode
  • Rust
let mut variable = "Hello World!"
Enter fullscreen mode Exit fullscreen mode
  • Swift
var variable = "Hello World!"
Enter fullscreen mode Exit fullscreen mode
  • ruby
variable = "Hello World!"
Enter fullscreen mode Exit fullscreen mode

That's it for now!
I hope you learnt something new and make sure to view all of my posts (and maybe follow).

Top comments (0)