BEGIN A NEW ADVENTURE
Interested in learning new things with an awesome group of people?


PC Change value of two variables at once

Discussion in 'Programing & Web Development' started by BoliBerrys, Jan 29, 2017.

  1. BoliBerrys C# > Any other language

    BoliBerrys

    Total Messages:
    81
    Likes Received:
    47
    Trophy Points:
    28
    Starter
    Hello Guys.

    Today i'm going to show you how to make two variables have the same value.

    First of, i want to start saying i tested this on JavaScript and on C#. I'm not sure if it works on every language.

    Okey. So let's say we have the following variables:

    PHP:
    int start 10;
    int rounds 2;
    int timer;
    int current;
    We want timer and current to have the following value:

    PHP:
    timer start rounds;
    current start rounds;
    Instead of typing two times the same line of code, we can do the following:
    PHP:
    timer current start rounds;
    As you can see, it works just fine:
    [​IMG]



     
    LEGACYY likes this.
  2. Loading...

    Similar Threads Forum Date
    C# Wallpaper-Changer for windows (source code) Programing & Web Development Oct 27, 2015

  3. LEGACYY ⚝ Retired ⚝

    LEGACYY

    Total Messages:
    2,396
    Likes Received:
    750
    Trophy Points:
    123
    Great share buddy! :thumbup:
     
  4. 1UP New Gamer

    1UP

    Total Messages:
    27
    Likes Received:
    18
    Trophy Points:
    13
    While this does work, it's generally bad practice to do something like this especially if you are working on a team project. It actually makes the code harder to read if that makes sense.
     
This website runs by the community, for the community... and it needs advertisements in order to keep running. Please disable your ad-blocker, or become a Prime member to hide all advertisements and this notice.