= is not a member of Uni...">Geek Answers HandbookScala when assigning a loopI am trying to port some Java code to Scala:while ((j=f('blah'))>=0) ... ERROR: "value> = is not a member of Unit"Is it impossible?+6java scalaetw3 Mar 03 '13 at 23:19source share1 answerAssignments return () (unit) in Scala. But this is normal, because you can put a block of code anywhere. You need it: while ({ j=f("blah"); j } >= 0) ... +16Rex kerr Mar 03 '13 at 23:20source shareMore articles:xlsx compressed rubyzip cannot be read Excel - ruby | fooobar.comPHP library for parsing Google-like search operators? - phpJenkins - How to start a post build without re-working? - continuous-integrationTesting HTTPS Locally with Coldfusion - coldfusionBasic session processing using WebAPI and RavenDB - asp.net-web-apiHow to disable SSH in GitBash and use HTTPS instead - gitexcel - vba - custom form - frame - setting scroll bar - excel-vbaHow to fix Index Out Of Range Error - c #Go - how to handle common fields between types of structures - typesSet / Remove debug flag during grunt / requirejs build - javascriptAll Articles
I am trying to port some Java code to Scala:
while ((j=f('blah'))>=0) ...
ERROR: "value> = is not a member of Unit"
Is it impossible?
Assignments return () (unit) in Scala. But this is normal, because you can put a block of code anywhere. You need it:
()
while ({ j=f("blah"); j } >= 0) ...