Heroes areback
@vectorsigma01
looking for bachelor degree
java(cp)
just embed image it's been three days , doing the same
I'm noob
Java
type checks and automatic casts
i was practicing this and couldn't solve this please solve
Kotlin
AmoghTheCool the bug here is that you are not calling the functions in the main function as you should be doing. An error-free version of this would be:
fun getStringlength(obj:Any):Int?{
if (obj is String && obj.length>0){
return obj.length
}
return null
}
fun main(){
fun printLength(obj:Any){
println("Getting the length of '$obj'.Result: ${getStringlength(obj) ?:"Error: The object is not a string"} ")
}
printLength("Incomprehensibilities")
printLength("")
printLength(1000)
}
`2 years ago
kotlin: use of raw strings
raw string means it has three quotes
please insert double quote two times inside the first double quote and press enter
cod
Kotlin
AmoghTheCool kewl and interesting read! Also to make code in markdown use triple backtails (val myVar: String = "hello world";
`2 years ago
vectorsigma01 edit:
please insert double quote two times inside the first double strings and press enter2 years ago