2020-04-25 18:49:16 +03:00
|
|
|
fn concatenation_of_strings() {
|
|
|
|
_ := 'Simple' + 'Concat'
|
|
|
|
_ := 'Hello'
|
|
|
|
+ ' ' +
|
|
|
|
'World' + '!'
|
|
|
|
_ := 'There' + ' ' + 'so' + ' ' + 'many' + ' ' + 'words' + ' ' + 'they' + ' ' + "don't" + ' ' + 'fit' + ' ' + 'in' + ' ' + 'one' + ' ' + 'line'
|
|
|
|
}
|
2021-01-23 11:33:22 +03:00
|
|
|
|
|
|
|
fn concat_inside_ternary() {
|
|
|
|
{ // This block is needed to force line wrapping
|
|
|
|
cline := if iline == pos.line_nr {
|
|
|
|
sline[..start_column] + color(kind, sline[start_column..end_column]) + sline[end_column..]
|
|
|
|
} else {
|
|
|
|
sline
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-01-28 13:23:48 +03:00
|
|
|
|
|
|
|
fn concat_two_or_more_ternaries() {
|
|
|
|
x := if some_condition { 'very long string part' } else { 'def' } + if y == 'asd' { 'qwe' } else {'something else'}
|
|
|
|
var := if other_condition { 'concat three long ternary ifs' } else { 'def' } + if true {'shorter'} else {'quite short'} + if true { 'small' } else {'tiny'}
|
|
|
|
}
|