Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Comment
by
ucho
· 10y ago · 0 comments
Java has also alternative approach:
final a; if (predicate) { a = 3; } else { a = 5; }
`final` makes it possible for variable to be assigned exactly once. Verbose but useful when "?:" is not a good fit.
Comments
No comments yet.
Better HN