Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Lazy initialization
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Scala=== [[Scala (programming language)|Scala]] has built-in support for lazy variable initiation.<ref>{{Cite book |last1=Pollak |first1=David |date=2009-05-25 |url=https://books.google.com/books?id=Qt-bRFetWw0C&q=scala+lazy+variables&pg=PA30 |title=Beginning Scala |publisher=Apress |isbn=9781430219897}}</ref> <syntaxhighlight lang="scala" highlight="1,4,6,9"> scala> val x = { println("Hello"); 99 } Hello x: Int = 99 scala> lazy val y = { println("Hello!!"); 31 } y: Int = <lazy> scala> y Hello!! res2: Int = 31 scala> y res3: Int = 31 </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)