Logo

Programming-Idioms

Initialize a constant planet with string value "Earth".
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
planet : constant String := "Earth";
const char *_planet = "Earth";
(def planet "Earth")
#include <string>
// using char*
constexpr char planet[] = "Earth";

// using string
const std::string planet{"Earth"};
const string _planet = "Earth";
enum string planet = "Earth";
static immutable string planet = "Earth";
enum planet = "Earth";
immutable string planet = "Earth";
const string planet = "Earth";
const String _planet = "Earth";
planet = "Earth"
Planet = "Earth".
character(*), parameter :: planet = "Earth"
  character(len=*), parameter :: planet = "Earth"
const planet = "Earth"
static final planet = "Earth"
static final planet = 'Earth'
static final planet = /Earth/
static final planet = '''Earth'''
static final planet = """Earth"""
planet = "Earth"
const planet = 'Earth'
private final String planet = "Earth";
final String planet = "Earth";
static final String planet = "Earth";
val planet = "Earth"
(defparameter +planet+ "Earth")
PLANET = "Earth"
NSString * const Planet=@"Earth";
const PLANET = 'Earth';
define('PLANET', 'Earth');
const
  planet = 'Earth';
use Const::Fast qw(const);
const my $planet => 'Earth';
use constant planet => 'Earth';
use constant PI => 3.14159;
use constant { RED => 1, BLUE => 2, GREEN => 3 };
PLANET = 'Earth'
Planet = 'Earth'
const PLANET: &str = "Earth";
val planet = "Earth"
planet := 'Earth'.
Const PLANET = "Earth"