Given two int variables, firstPlaceWinner and secondPlaceWinner, write some code that swaps their values.

Given two int variables, firstPlaceWinner and secondPlaceWinner, write some code that swaps their values.

LANGUAGE: Visual Basic

CHALLENGE:

Given two int variables, firstPlaceWinner and secondPlaceWinner, write some code that swaps their values.  Declare any variables as necessary, but do not redeclare firstPlaceWinner and secondPlaceWinner.

SOLUTION:

dim temp as Integer
temp = firstPlaceWinner
firstPlaceWinner = secondPlaceWinner
secondPlaceWinner = temp

Add comment