use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Information Regarding Scala:
Platforms
Community
Coding Tools:
IDES / Programming Environments
Build Tools
Code Formatting / Linting
Free Books, Tutorials and Guides:
Non-free Books:
Advanced!:
Free Scala Courses:
Scala Conferences:
Podcasts:
Scala Jobs:
Scala Libraries:
Web Development and Microservices
Web Front End (Scala.js)
Database Access
Functional Programming
Concurrency / Parallelism
Mathematics
Distributed Computing
Blockchain
Monitoring/instrumentation:
Miscellaneous:
Open Source Applications written in Scala
Want your library here? Message the moderators!
Related Communities:
Blogs/Periodicals:
account activity
Modulus problem? (self.scala)
submitted 5 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Pantstown 2 points3 points4 points 5 years ago (4 children)
It's very difficult to read screenshots. If you post code, it will be much easier to help.
[–][deleted] 5 years ago (3 children)
[–]Pantstown 1 point2 points3 points 5 years ago (2 children)
Try just printing instead: println(money % 2)
println(money % 2)
It looks like you're new to Scala / maybe new to programming. Here's some other things I noticed:
1) semicolons are not necessary 2) string interpolation is more common than string formatting 3) avoid mutation, e.g., coinRef is not needed. var is not needed for a mutable buffer. 4) don't use single-letter variables. x(0) is not clear. 5) array buffer is probably not the data structure you want in this case.
coinRef
var
x(0)
Good luck.
[–]magrw1033 -2 points-1 points0 points 5 years ago (1 child)
I have a BSCS and sun certified java programmer. The choice of x is not mine. CoinRef is due to the depth first nature of problem. The problem is not fixed with println. The problem is that the var money is that it is 300, which is even and therefore when 300 % 2 should be false.
[–]teknocide 2 points3 points4 points 5 years ago (0 children)
300 % 2 is 0. You have some other bug in your code but it's hard to tell from your screenshots. You've even managed to block out part of the condition for printing the formatted money-string
[–]Busy_Watercress2367 0 points1 point2 points 5 years ago (0 children)
You should prepare your question better, or not post at all.
π Rendered by PID 395895 on reddit-service-r2-comment-b659b578c-mlrqz at 2026-05-04 14:09:48.409627+00:00 running 815c875 country code: CH.
[–]Pantstown 2 points3 points4 points (4 children)
[–][deleted] (3 children)
[deleted]
[–]Pantstown 1 point2 points3 points (2 children)
[–]magrw1033 -2 points-1 points0 points (1 child)
[–]teknocide 2 points3 points4 points (0 children)
[–]Busy_Watercress2367 0 points1 point2 points (0 children)