This language bar is your friend. Select your favorite languages!
Select your favorite languages :
- Or search :
- Ada
- C
- Clojure
- C++
- C#
- D
- D
- D
- D
- D
- Dart
- Elixir
- Erlang
- Fortran
- Fortran
- Go
- Groovy
- Haskell
- JS
- Java
- Java
- Java
- Kotlin
- Lisp
- Lua
- Obj-C
- PHP
- PHP
- Pascal
- Perl
- Perl
- Python
- Ruby
- Rust
- Scala
- Smalltalk
- VB
static final planet = "Earth"
static final planet = 'Earth'
static final planet = /Earth/
static final planet = '''Earth'''
static final planet = """Earth"""
Various ways to define strings in Groovy.
const my $planet => 'Earth';
Module Const::Fast is preferred over Readonly, which is greatly preferred over 'use constant'. Google "Perl Critic Policy Prohibit Constant Pragma" and read the Const::Fast documentation for more details.
use constant planet => 'Earth';
use constant PI => 3.14159;
use constant { RED => 1, BLUE => 2, GREEN => 3 };
Perl's classic way to create constants. For various reasons, module Readonly (or even better, Const::Fast) are now preferred.