RosettaCodeData/Task/Reverse-a-string/V-(Vlang)/reverse-a-string.v
2023-07-01 13:44:08 -04:00

18 lines
315 B
V
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const list =
('
Hello world!
Salamu, Dunia!
¡Hola Mundo!
Chào thế gii!
Hallo Welt!
')
fn main() {
for line in list.split('\n') {if line !='' {println(reverse_string(line))}}
}
fn reverse_string(word string) string {
return word.runes().reverse().string()
}