Merge: doc: fixed some typos and other misc. corrections
[nit.git] / tests / base_adaptive_loop_null2.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import core::kernel
16
17 var x
18 x = null
19
20 var i = 0
21 while i < 2 do
22 var y
23 y = x
24 if y == null then 1.output
25 y = x
26 if y != null then 2.output
27 y = x
28 if y isa Int then 3.output
29 y = x
30 if y isa nullable Int then 4.output
31 y = x
32 if y isa nullable Bool then 5.output
33 y = x or else 6
34 y.output
35 #alt1#x = 1
36
37 i += 1
38 end
39
40 x = 10
41 i = 0
42 while i < 2 do
43 var y
44 y = x
45 if y == null then 1.output
46 y = x
47 if y != null then 2.output
48 y = x
49 if y isa Int then 3.output
50 y = x
51 if y isa nullable Int then 4.output
52 y = x
53 if y isa nullable Bool then 5.output
54 y = x or else 6
55 y.output
56 #alt1#x = null
57
58 i += 1
59 end