This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ---------------------------------- <-- a BorderLayout with a North and Center | |
| | Type a URL | GO | <-- a (1,2) Gridlayout | |
| |--------------------------------| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | HTML DATA | <-- a (1,1) Gridlayout | |
| | | | |
| | | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ---------------------------------- | |
| | Type a URL | GO | | |
| |--------------------------------| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | HTML DATA | | |
| | | | |
| | | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.applet.*; | |
| import java.awt.*; | |
| import java.awt.event.*; | |
| import javax.swing.*; | |
| import java.net.*; | |
| import java.io.*; | |
| public class FrameLayoutURLReader extends JFrame implements ActionListener { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protocol MailingAddress { | |
| var address: String { get } | |
| } | |
| protocol TextRepresentable { | |
| func represent() -> String | |
| } | |
| extension Int: TextRepresentable { | |
| func represent()->String{ | |
| return "\(self)" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| enum SortMethod { | |
| case AscendingPriority | |
| case DescendingPriority | |
| case AscendingDueDate | |
| case DescendingDueDate | |
| func sort_function()->(Homework, Homework)->Bool{ | |
| switch self { | |
| case AscendingPriority: | |
| return { (h1, h2) in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| enum Subject { | |
| case English | |
| case Programming | |
| case Language | |
| case Science | |
| case History | |
| } | |
| struct Homework { | |
| var subject: Subject | |
| var due_date: String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var x: Int = 10 //statically typed variable | |
| var y = 30.0 //dynamicly typed variable | |
| var z: Double = Double(x)+y //Because x is an integer, we have to tell swift to add these numbers as doubles | |
| var 國 = "美國"//We can use characters and emojis as variable names | |
| let name="Jacob Aronoff"//let means the variable is immutable or final | |
| print("My name is \(name)")//Print is just like in python | |
| let students = ["Jacob","Sam","Corey","Michael"]//Swift array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| todos = [] | |
| def main(): | |
| print("Welcome to your todolist!") | |
| add_todo() | |
| print_todos() | |
| while(True): | |
| choice = raw_input( | |
| "If you want to add to your list say 'add', if you want to remove things say 'remove', if you want to see your todos say 'print', say anything else to exit ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| students = ["Jacob", "Sam", "Corey", "Michael"] | |
| num = 0 | |
| while num < len(students): | |
| print(students[num]) | |
| num += 1 | |
| for student in students: | |
| print(student) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| secret_number = 27 | |
| lower_bound = 0 | |
| upper_bound = 100 | |
| their_number = -100 | |
| def guessing_game(number): | |
| if number <= lower_bound or number >= upper_bound: | |
| print("Out of bounds!") | |
| return # stops the method, we could also just say return, but break is a really useful control flow statement |