I am using some example code from the internet that manages music. One section of the code is a way of pausing music and preparing it to play again. I am not understanding a double bracket notation. I thought it may have been a fancy way of doing an If-Else, but my equivalent snippet of code does not work, however, the code with the double brackets works perfectly. What exactly does it mean when you add two open brackets to an If-statement?
Here is the snippet of code
// previousMusic should always be something valid
if (currentMusic != -1) {{
previousMusic = currentMusic;
Log.d(TAG, "Music is paused");
}
currentMusic = -1;
Log.d(TAG, "Paused music is prepared to play again (if necessary)");
}
Here is what I thought it could have meant. It does not work as intended, so this is not the same actually.
// previousMusic should always be something valid
if (currentMusic != -1) {
previousMusic = currentMusic;
Log.d(TAG, "Music is paused");
} else {
currentMusic = -1;
Log.d(TAG, "Paused music is prepared to play again");
}
Thank you in advance for the explanation.