Click here to Skip to main content
15,030,162 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: For the love of bacon: Get the heck out of California Pin
grralph12-Aug-21 1:33
Membergrralph12-Aug-21 1:33 
RantRe: For the love of bacon: Get the heck out of California Pin
W Balboos, GHB2-Aug-21 3:12
mveW Balboos, GHB2-Aug-21 3:12 
GeneralRe: For the love of bacon: Get the heck out of California Pin
honey the codewitch2-Aug-21 3:20
mvahoney the codewitch2-Aug-21 3:20 
GeneralRe: For the love of bacon: Get the heck out of California Pin
Greg Utas2-Aug-21 3:57
mvaGreg Utas2-Aug-21 3:57 
GeneralRe: For the love of bacon: Get the heck out of California Pin
W Balboos, GHB2-Aug-21 4:17
mveW Balboos, GHB2-Aug-21 4:17 
GeneralRe: For the love of bacon: Get the heck out of California Pin
Slow Eddie3-Aug-21 2:34
professionalSlow Eddie3-Aug-21 2:34 
GeneralRe: For the love of bacon: Get the heck out of California Pin
englebart3-Aug-21 14:03
professionalenglebart3-Aug-21 14:03 
RantKotlin not-null assertion. Am I missing something? Pin
Cp-Coder1-Aug-21 2:48
MemberCp-Coder1-Aug-21 2:48 
In Kotlin you have a not-null assertion operator: !! For example:

val length = username!!.length

From the excellent book: Android Studio 4.2 Development Essentials:

The above code will crash if username is null. Huh? Also:

Use of the not-null assertion is generally discouraged and should only be used in situations where you are certain that the value will not be null! Huh?!

What then is the purpose of the !! operator? If you are certain the value is not null, why use the operator at all? If it is null the code will crash the same way with or without the operator!

I must be missing something here! Confused | :confused:
Get me coffee and no one gets hurt!



modified 1-Aug-21 10:26am.

GeneralRe: Kotlin not-null assertion. Am I missing something? Pin
Greg Utas1-Aug-21 2:51
mvaGreg Utas1-Aug-21 2:51 
GeneralRe: Kotlin not-null assertion. Am I missing something? Pin
OriginalGriff1-Aug-21 3:12
mveOriginalGriff1-Aug-21 3:12 
GeneralRe: Kotlin not-null assertion. Am I missing something? Pin
Kornfeld Eliyahu Peter1-Aug-21 4:09
professionalKornfeld Eliyahu Peter1-Aug-21 4:09 
GeneralRe: Kotlin not-null assertion. Am I missing something? Pin
Cp-Coder1-Aug-21 4:27
MemberCp-Coder1-Aug-21 4:27 
GeneralRe: Kotlin not-null assertion. Am I missing something? Pin
DaveAuld1-Aug-21 8:48
professionalDaveAuld1-Aug-21 8:48 
GeneralRe: Kotlin not-null assertion. Am I missing something? Pin
Cp-Coder1-Aug-21 9:53
MemberCp-Coder1-Aug-21 9:53 
GeneralRe: Kotlin not-null assertion. Am I missing something? Pin
Richard Deeming1-Aug-21 21:37
mveRichard Deeming1-Aug-21 21:37 
GeneralRe: Kotlin not-null assertion. Am I missing something? Pin
GuyThiebaut1-Aug-21 23:49
professionalGuyThiebaut1-Aug-21 23:49 
GeneralRe: Kotlin not-null assertion. Am I missing something? Pin
GuyThiebaut2-Aug-21 0:59
professionalGuyThiebaut2-Aug-21 0:59 
GeneralRe: Kotlin not-null assertion. Am I missing something? Pin
englebart3-Aug-21 14:14
professionalenglebart3-Aug-21 14:14 
GeneralUnicode was developed by Vogons. Change my mind. Pin
honey the codewitch1-Aug-21 1:40
mvahoney the codewitch1-Aug-21 1:40 
GeneralRe: Unicode was developed by Vogons. Change my mind. Pin
Gerry Schmitz1-Aug-21 5:26
mveGerry Schmitz1-Aug-21 5:26 
JokeRe: Unicode was developed by Vogons. Change my mind. Pin
Peter_in_27801-Aug-21 16:06
professionalPeter_in_27801-Aug-21 16:06 
GeneralRe: Unicode was developed by Vogons. Change my mind. Pin
lmoelleb1-Aug-21 22:40
Memberlmoelleb1-Aug-21 22:40 
GeneralRe: Unicode was developed by Vogons. Change my mind. Pin
honey the codewitch2-Aug-21 2:43
mvahoney the codewitch2-Aug-21 2:43 
GeneralStop it with the sh Pin
harold aptroot31-Jul-21 22:00
Memberharold aptroot31-Jul-21 22:00 
GeneralRe: Stop it with the sh Pin
Richard MacCutchan31-Jul-21 22:09
mveRichard MacCutchan31-Jul-21 22:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.