Module 1 Part 2 Conditionals and Loops If

Module 1 Part 2 Conditionals and Loops If
1 / 1
Module 1 Part 2 Conditionals and Loops If - slide 1 of 24 Module 1 Part 2 Conditionals and Loops If - slide 2 of 24 Module 1 Part 2 Conditionals and Loops If - slide 3 of 24 Module 1 Part 2 Conditionals and Loops If - slide 4 of 24 Module 1 Part 2 Conditionals and Loops If - slide 5 of 24 Module 1 Part 2 Conditionals and Loops If - slide 6 of 24 Module 1 Part 2 Conditionals and Loops If - slide 7 of 24 Module 1 Part 2 Conditionals and Loops If - slide 8 of 24 Module 1 Part 2 Conditionals and Loops If - slide 9 of 24 Module 1 Part 2 Conditionals and Loops If - slide 10 of 24 Module 1 Part 2 Conditionals and Loops If - slide 11 of 24 Module 1 Part 2 Conditionals and Loops If - slide 12 of 24 Module 1 Part 2 Conditionals and Loops If - slide 13 of 24 Module 1 Part 2 Conditionals and Loops If - slide 14 of 24 Module 1 Part 2 Conditionals and Loops If - slide 15 of 24 Module 1 Part 2 Conditionals and Loops If - slide 16 of 24 Module 1 Part 2 Conditionals and Loops If - slide 17 of 24 Module 1 Part 2 Conditionals and Loops If - slide 18 of 24 Module 1 Part 2 Conditionals and Loops If - slide 19 of 24 Module 1 Part 2 Conditionals and Loops If - slide 20 of 24 Module 1 Part 2 Conditionals and Loops If - slide 21 of 24 Module 1 Part 2 Conditionals and Loops If - slide 22 of 24 Module 1 Part 2 Conditionals and Loops If - slide 23 of 24 Module 1 Part 2 Conditionals and Loops If - slide 24 of 24
Module 1 Part 2 Conditionals and Loops If statements in Java They work the same as if statements in Python. You dont put a : after the if, or else statement, instead you use s after each part. elif in Python is else if in Java Each

Related Topics

Download this presentation From Below

"Module 1 Part 2 Conditionals and Loops If" is the property of its rightful owner. Permission is granted to download and print the materials on this website for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.

Presentation Transcript

01
Module 1 Part 2
Conditionals and Loops<br>
02
If statements in Java They work the same as if statements in Python.
You don’t put a : after the if, or else statement, instead you use {}’s after each part.
elif in Python is else if in Java
Each conditional must evaluate to a boolean value.
if(x>3)
The conditional must have ()’s around it.
if statements can have:
Unlimited else if statements
Optional else statements<br>
03
Conditionals – Java import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner myScan=new Scanner(System.in);
System.out.println("What is your age?");
int age=myScan.nextInt();
if(age<18) {
System.out.println("You cannot drink or vote");
}
else if(age<21) {
System.out.println("You can vote but not drink");
}
else {
System.out.println("You can vote and drink, don't do them together");
}
}
}<br>