The Home Work has three components to be delievered before 9AM:
- Null safety.
- Strings.
- Numbers.
Note: You must save all your solution as
solution.kt
to be submitted before 9AM.โ ๏ธ
In the code below, add an if
statement to the beginning of getLength
that
returns zero if str
is null:
fun getLength(str: String?) : Int {
// Add null check here
return str.length;
}
fun main(args: Array<String>) {
println(getLength("This is a string!"))
}
old = The quick brown fox jumps over the lazy dog.
new = brown fox jumps.
C = (5 (F-32)) / 9.
212.0 degree Fahrenheit is equal to 100.0 in Celsius.