Shorter way to write "x := x + 1;" and others

Magno
Member Posts: 168
I suppose most of you will know this,
but as i see in many examples and code many people work with
This is much simpler and shorter:
but as i see in many examples and code many people work with
x := x + 1;
dito for - , * and /
x := x - 1;
x := x * 1;
x := x / 1;
This is much simpler and shorter:
x += 1;
x -= 1;
x *= 1;
x /= 1;
0
Comments
-
Yes, but it is wasn't recommended because the NDT had problems with that. I do not know actual situation...
And main thing> it was not supported and never guaranteed that this :feature: will be in next versions too (it is something what is working but is not documented and without warranty)0 -
Changed title from "I'm lazy too" to "Shorter way to write "x := x + 1;" and others"Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Standard C/C++/C# stuff, I see no reason why should they remove it.0
-
Miklos Hollender wrote:Standard C/C++/C# stuff, I see no reason why should they remove it.
Because they're Microsoft.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
I seriously doubt that this wil be removed, because it is used a lot in standard NAV code. Besides it is a very common notation in many programming languages, and there really is no reason for them to remove it.0
-
Yes, but for example, there can be problem in NDT connected to that and it will be without support. Officially. And this was point of view from time of "old" Navision, not Microsoft :-)0
-
Well Microsoft won't even modify existing code if there is a valid reason (SQL Server performance anyone?), so I don't really see them modifying existing code to accommodate removing this from the syntax. Not to mention the kind of trouble they will get from the partner channel that will have to review THEIR code. It's not worth it for them to remove it, I really don't see that happening.0
-
I agree with you :-) I am not arguing with you... (just want to be sure you know it - written word is too weak to describe all) 8)
Time's changing and what I wrote is about something few years old. Now is another time.0 -
I know you agree with me on this one, I wasn't trying to argue with you, just discussing0
-
I encountered problems with += in certain cases (NAV3.7).
It just didn't work, so I had to use x:=x+1 instead of x+=1
Unfortunately, i don't have examples, but i would not recommend to use such expressions.0 -
I need specific examples before I concede on this one. I've been using += etcetera for almost 7 years and never had any issues with it.0
-
DenSter wrote:I need specific examples before I concede on this one. I've been using += etcetera for almost 7 years and never had any issues with it.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Okay, I made some investigations and have to say, that += does not work only with CODE variables, though it works ok with TEXT ones.0
-
DenSter wrote:I need specific examples before I concede on this one. I've been using += etcetera for almost 7 years and never had any issues with it.
Definitely thereare some cases where it does not work, but they are rare. For example in 2.00 there was an issue with
MyDate += 1; to increment date even though it worked fine in 1.3 and then again in 2.01 (It may not be exactly that, butsomehting similar, itwas along time ago).
I have never seen a problem with integer, text or Decimal though.David Singleton0 -
Well I would never use a math operator to increase a date, I would use CALCDATE.0
-
I wouldn't use it either, I was just answering your question ](*,)David Singleton0
-
-
DenSter wrote:I didn't think I had a question thoughDenSter wrote:I need specific examples before I concede on this one. I've been using += etcetera for almost 7 years and never had any issues with it.
I guess I took that as a question. THough looking closely I see there is no "?" mark at the end, so technically it wasn't really a quesiton :roll:
Sorry, moving from town to town stopping at internet cafes checking for news from police and consulates, is probably not the ideal time to be replying on forums, but it gives me some time to relax I suppose.David Singleton0 -
DenSter wrote:Well I would never use a math operator to increase a date, I would use CALCDATE.
I don't see why not, the operator should only be a direct mapping to the CALCDATE function in any case.
No different to what overloaded operators in C++ would do in such a case of a date class which would provide a CALCDATE function and map the mathematical operators directly onto it. If one method works, so should the other.0 -
I'm just a simple soul, I don't have a degree in advanced mathmatics. When I need to manipulate a date, I always use CALCDATE. It has never occurred to me that you could ever use + to add a day to a date. For large text concatenations I always use text constants and string substitutions. This just makes sense to me, to me that is less cluttered.0
-
David Singleton wrote:I guess I took that as a question.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions