When you choose NOT to register with a political party - giving you as a voter the designation "Unaffiliated" - you forfeit your ability to vote in party primaries which are scheduled before the major elections in the fall. For instance - if there is a party primary for Mayor because multiple candidates are seeking the office, as an "Unaffiliated" voter, you are ineligible to vote in the party primary and only have the ability to vote in the Fall election that year.
You may change your party affiliation at any time - though according to State statute, there is a 3-month waiting period after switching parties for you to be eligible to vote in a party primary. If you switched party affiliation from Party A to Party B on June 1st, you would be ineligible to vote in Party B's primary until September 1st.