[ Log In ]
3 pin slide switch

SPDT Slide Switch 3 pin 30V

$1.49
Qty:
Tactile momentary push button switch 6 mm x 6 mm (through hole)
LED button tactile switch

LED Button Tactile Switch

$1.89
Qty:
Small red knob for potentiometer

Small Knob for Potentiometer - Black with Red Cap

$0.94
Qty:
Multimeter Security Banana Plug To Test Hook Clip Probe Lead Cable 500V

Multimeter Security Banana Plug To Test Hook Clip Probe Lead Cable 500V

$8.99
Qty:
3 Foot USB Cable Type A to USB Cable Type A

USB Cable Type A Male to USB Type A Male - 3 FT

$2.65
Qty:
USB 2.0 Cable 10 Foot Type A Male to Type B Male

USB 2.0 Cable Type A Male to Type B Male - 10 FT

$4.80
Qty:
Tumbnail: 62 oz-in NEMA 17 Stepping motors (also called stepper motor)

NEMA 17 Stepping Motor (62 oz-in 5mm single shaft)

$19.95 Out of Stock
Qty:
Image of the Atmega324p

Atmega324P

$8.50
Qty:

Programming: The If Else Condition Compared to the Switch Case Condition

The if else condition can be used as an alternative to the switch case conditional statement and vice versa.
The switch case conditional statement:

switch (Variable)
{
case FirstValue:
//Code to execute when FirstValue is matched
//...
break;
case SecondValue:
//Code to execute when SecondValue is matched
//...
break;
case ThirdValue:
//Code to execute when ThirdValue is matched
//...
break;
default:
//Default code
break;
}

The if else conditional statement:

if (variable == FirstValue)
{
//Code to execute when FirstValue is matched
//...
}
else if (variable == SecondValue)
{
//Code to execute when SecondValue is matched
//...
}
else if (variable == ThirdValue)
{
//Code to execute when ThirdValue is matched
//...
}
else
{
//Default code
}

Comments and Additional Information

Have some code to share? Or additional information? Respond here:

You need to be logged in to save a response on this page. The response must be constructive, helpful, supplimentary or to correct the existing video, code or narrative content.

Description:

Code (optional):