scope: refuse `&x` where x is a local variable
[nit.git] / examples / rosettacode / reverse_words.nit
1 #!/usr/bin/env nit
2 #
3 # This file is part of NIT ( http://www.nitlanguage.org ).
4 # This program is public domain
5
6 # Task: Reverse words in a string
7 # SEE: <http://rosettacode.org/wiki/Reverse_words_in_a_string>
8 module reverse_words
9 var text = """
10 ---------- Ice and Fire ------------
11
12 fire, in end will world the say Some
13 ice. in say Some
14 desire of tasted I've what From
15 fire. favor who those with hold I
16
17 ... elided paragraph last ...
18
19 Frost Robert -----------------------"""
20
21 for l in text.split("\n") do print l.split(" ").reversed.join(" ")