I'm trying to assign a different variable name for each value returned from the if else expression. This is because I want to use the return value later in my program and how to use it depends on which branch (if or else) is executed.
for example;
if(5<1) {val x = 5;x} else {val y = 1; y}
current output:
res31: Int = 1
Desired output:
y: Int = 1
Thanks
Aucun commentaire:
Enregistrer un commentaire