Cursus Raku / Elementa / Fundamenta variabilium et generum datorum / Catenae

Catena concatenatio

Si duas habes chordas, eas coniungere potes et novam longiorem chordam obtinere. Haec actio concatenatio chordarum appellatur. In Raku, chordas concatenas utens—quid putas?—concatenationis operatore. Hic operator est tilde: ~. Ad duas chordas concatenandas, pone ~ inter eas:

say 'Hello, ' ~ 'World!';

Si nostrae chordae in variabilibus continentur, possumus ‘variabiles concatenare’, bene, re vera, concatenare chordas quas illae variabiles continent:

my $greeting = 'Hello, ';
my $who = 'World!';

say $greeting ~ $who;

Vel potes creare novam variabilem utens valore concatenato:

my $greeting = 'Hello, ';
my $who = 'World!';
my $message = $greeting ~ $who;

say $message;

Concatenatio cum assignatione

Cum variabilem renovare debes et novam chordam ei adiungere, utere hac forma:

# Pro
$str = $str ~ $another-str;

# utere:
$str ~= $another-str;

Exercitatio

Sequuntur 3 quiz de contentis huius argumenti.

Catenae   |   Quiz 1: Concatenatio catenarum


💪 Vel recta ad exercitationes huius sectionis i.