File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed 
tp1/src/main/kotlin/fmt/kotlin/fundamentals Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -3,40 +3,44 @@ package fmt.kotlin.fundamentals
33var  x =  0 
44
55fun  incrementXAndReturnOldValue (): Int  {
6-     return  - 1 
6+     return  x ++ 
77}
88
99fun  incrementXAndReturnNewValue (): Int  {
10-     return  - 1 
10+     return  ++ x 
1111}
1212
1313fun  sumZeroPointFive (): Float  {
14-     return  - 1f 
14+     return  x  +   0.5f 
1515}
1616
1717fun  subtractBigNumber (): Int  {
18-     return  - 1 
18+     return  x  -   1_854_643 
1919}
2020
2121fun  buildRangeOpen (): IntRange  {
22-     return  0 .. 0 
22+     return  1 .. 42 
2323}
2424
2525fun  buildRangeOpenEnded (): IntRange  {
26-     return  0 .. 0 
26+     return  1 .. < 42 
2727}
2828
2929/* *
3030 * n Number of bottles. Always more than 2. 
3131 */  
3232fun  describeNbBottles (): String  {
33-     return  " " 
33+     return  " There are  $x  bottles " 
3434}
3535
3636var  totalBottles =  0 
3737var  nbWhiteBottles =  0 
3838var  nbRedBottles =  0 
3939
4040fun  describeWithDetailNbBottles (): String  {
41-     return  " " 
41+     return  """ 
42+             There are $totalBottles  bottles : 
43+                 - $nbWhiteBottles  bottles of white 
44+                 - $nbRedBottles  bottles of red 
45+         """  .trimIndent()
4246}
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments