The + Operator Is Left Associative : Operators « Language Basics « C# / C Sharp






The + Operator Is Left Associative

  


using System;

public class MainClass {
    public static void Main() {

        Console.WriteLine(10 + 25 + "A");   // Same as (10 + 25) + "A", that is "35A" 
        Console.WriteLine("A" + 10 + 25);   // Same as ("A" + 10) + 25, that is "A1025" 

    }

}

   
  








Related examples in the same category

1.Math Operators with int value
2.Demonstrate the difference between prefix postfix forms of ++Demonstrate the difference between prefix 
   postfix forms of ++
3.Demonstrate the relational and logical operatorsDemonstrate the relational and logical operators
4.Demonstrate the short-circuit operatorsDemonstrate the short-circuit operators
5.Side-effects can be importantSide-effects can be important
6.Prevent a division by zero using the ? 1Prevent a division by zero using the ? 1
7.Self incrementSelf increment
8.Self decreaseSelf decrease
9.Illustrates the use of the comparison operatorsIllustrates the use of the comparison operators
10.Illustrates the use of the Boolean logical operatorsIllustrates the use of the Boolean logical operators
11.Ternary operatorTernary operator
12.Illustrates the use of the ternary operatorIllustrates the use of the ternary operator
13.Illustrates the use of the arithmetic operatorsIllustrates the use of the arithmetic operators
14.Illustrates the use of the bitwise operatorsIllustrates the use of the bitwise operators
15.Illustrates the use of the shortcut operatorsIllustrates the use of the shortcut operators
16.Prefix and postfix versions of the increment and decrement operatorsPrefix and postfix versions of the increment and decrement operators
17.Operator precedenceOperator precedence
18.Demonstrates compound assignment operatorsDemonstrates compound assignment operators
19.Relational Operators 3
20.Numeric Operators 3
21.Numeric Operators 1
22.Relational Operators
23.control the operator evaluation sequence
24.'logical and' and bitwise and
25.logical or and bitwise or
26.And Assignment
27.Or Assignment
28.Iff operator in C#
29.logical exclusive-or
30.Conditional operator and Math calculation
31.Add Assigment for both number and string value