Programmer Terms: Arrays, Conditionals, Loops
Variable
Arrays
A conditional is a branch in the code
Question: name any conditional types you know
If, Case, Switch, ifelse, ifelseif
All conditionals break down to...
Either true or false
If length of name is 0 {
reply "You gave me no name
} else {
reply "Hello name"
}NO
Computers do three things much faster or better then humans:
Math, Memory, and Repetition
Looping allows a computer to repeat a segment of code as long
as the developer wishes depending on the need.
Incoming geek joke...
Question: What are some kinds of Loops?
For, While, Do While
Javascript
C
function punishmentCheat(sentence) {
for (var count = 0; count < 500; count++) {
console.log(sentence);
}
}
punishmentCheat("I will not throw paper airplanes in class.");
A for loop runs until a conditional is met
Notes:
function punishmentCheat(sentence) {
for (var i = 0; count < 500; count++) {
console.log(sentence);
}
}
punishmentCheat("I will not throw paper airplanes in class.");
A while loop runs while a conditional is true
Notes:
function punishmentCheat(sentence) {
count = 0;
while (count < 500) {
console.log(sentence);
count++;
}
}
punishmentCheat("I will not throw paper airplanes in class.");
A do while loop runs while a conditional is true
Notes:
function punishmentCheat(sentence) {
count = 0;
do {
console.log(sentence);
count++;
} while (count < 500)
}
punishmentCheat("I will not throw paper airplanes in class.");
https://www.hackerrank.com/contests/master/challenges/c-tutorial-conditional-if-else?