Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xtend2] Difference between val and var ?
[Xtend2] Difference between val and var ? [message #684471] Wed, 15 June 2011 16:11 Go to next message
Jos Warmer is currently offline Jos WarmerFriend
Messages: 114
Registered: October 2010
Senior Member
Within an Xtend class I can use var and val keywords to define variables. E.g.
val String s1
var String s2

What is the difference between val and var ?
Re: [Xtend2] Difference between val and var ? [message #684475 is a reply to message #684471] Wed, 15 June 2011 16:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

vals are what final is in java.

Xtend <=> Java
val String s1 <=> final String s1 = null
var String s2 <=> String s2

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xtend2] Difference between val and var ? [message #684496 is a reply to message #684475] Wed, 15 June 2011 16:58 Go to previous messageGo to next message
Jos Warmer is currently offline Jos WarmerFriend
Messages: 114
Registered: October 2010
Senior Member
Christian,

Thanks, that is clear. I could not find it in the documentation. Either I did not look good enough, or otherwise it might be good to add this.

jos
Re: [Xtend2] Difference between val and var ? [message #684530 is a reply to message #684496] Wed, 15 June 2011 18:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

just for completeness: You find it in the Xtend Docs Section Expressions -> Variable Declarations

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 15 June 2011 18:39]

Report message to a moderator

Re: [Xtend2] Difference between val and var ? [message #684587 is a reply to message #684530] Wed, 15 June 2011 21:26 Go to previous message
Jos Warmer is currently offline Jos WarmerFriend
Messages: 114
Registered: October 2010
Senior Member
Christian,

thanks, you are right.
I should learn to read better Razz

jos
Previous Topic:EObject from global scope has less information
Next Topic:[Xtext 2.0] Bug in PreferenceStoreAccessImpl?
Goto Forum:
  


Current Time: Thu Apr 25 17:38:48 GMT 2024

Powered by FUDForum. Page generated in 0.03030 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top