This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun main(args:Array<String>){ | |
| // nullability() | |
| if_statement() | |
| } | |
| fun if_statement(){ | |
| val temp = 20 | |
| val feel= if (temp<10) "cold" | |
| else if(temp>20) "warm" | |
| else "OK" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun main(args:Array<String>){ | |
| // nullability() | |
| if_statement() | |
| } | |
| fun if_statement(){ | |
| val temp = 20 | |
| val feel= if (temp<10) | |
| "cold" | |
| else if(temp>20) | |
| "warm" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun main(args:Array<String>){ | |
| // nullability() | |
| if_statement() | |
| } | |
| fun if_statement(){ | |
| val temp = 20 | |
| val feel:String | |
| if (temp<10) | |
| feel="cold" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun main(args:Array<String>){ | |
| nullability() | |
| } | |
| fun nullability(){ | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun main(args:Array<String>){ | |
| // var_declarations() | |
| // ranges() | |
| // arrays() | |
| characters_and_strings() | |
| } | |
| fun characters_and_strings(){ | |
| //basic char and String | |
| val a='x' | |
| val b:Char='\u0041' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun main(args:Array<String>){ | |
| // var_declarations() | |
| // ranges() | |
| arrays() | |
| } | |
| fun arrays(){ | |
| var names:Array<String> =arrayOf("CAT","HOG","BOAR") | |
| names[0]="PIG" | |
| println(names.toList()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun main(args:Array<String>){ | |
| // var_declarations() | |
| // ranges() | |
| arrays() | |
| } | |
| fun arrays(){ | |
| var names:Array<String> =arrayOf("CAT","HOG","BOAR") | |
| names[0]="PIG" | |
| println(names.toList()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun main(args:Array<String>){ | |
| // var_declarations() | |
| // ranges() | |
| arrays() | |
| } | |
| fun arrays(){ | |
| var names:Array<String> =arrayOf("CAT","HOG","BOAR") | |
| names[0]="PIG" | |
| println(names.toList()) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun main(args:Array<String>){ | |
| // var_declarations() | |
| // ranges() | |
| arrays() | |
| } | |
| fun arrays(){ | |
| var names:Array<String> =arrayOf("CAT","HOG","BOAR") | |
| names[0]="PIG" | |
| println(names) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun main(args:Array<String>){ | |
| //var_declarations() | |
| ranges() | |
| } | |
| fun ranges(){ | |
| val a: IntProgression =1.rangeTo(10).reversed() | |
| for(x in a) println(x) | |
| println("sum of ints $a = ${a.sum()}") | |
| var b =10 downTo 1 |