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
| /* Arguments/parameters are values passed into a function | |
| * two kinds of A/p's are accepted in functions (Positional and Named) | |
| * function then uses those values to carry out provided instructions | |
| * (display on screen, use in a calculation, or send to another function) | |
| * | |
| * add is Positional required | |
| * addTwo is Named optional | |
| * addThree is Positional optional | |
| * addFour is Named with default values | |
| * addFive is Named parameters required |
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 'dart:math'; | |
| void main() { | |
| loveCalculator(); | |
| } | |
| // if (condition) {instruction();} | |
| // else {instruction();} | |
| // == means is or is equal to | |
| // != not equal to |
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
| void main() { | |
| } | |
| // if (condition) {instruction} | |
| // == means is or is equal to |
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
| void main() { | |
| // jenny is the new object | |
| Human jenny = Human(startingHeight: 15, weight: 3.5); | |
| // .height accessing height property | |
| // this object.get this property | |
| print(jenny.height); | |
| jenny.height = 20; | |
| print(jenny.height); | |
| // .talk triggers the talk method |
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
| void main() { | |
| // Object = new version of that class(); | |
| Car normalCar = Car(); | |
| print(normalCar.numberOfSeats); | |
| normalCar.drive(); | |
| ElectricCar coCo = ElectricCar(); | |
| coCo.drive(); | |
| coCo.rechargeBattery(); | |
| LevitatingCar aLevitatingCar = LevitatingCar(); | |
| aLevitatingCar.drive(); |
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
| /* | |
| *Create a list of integers and generate the two largest out of that list. | |
| Integer: a whole number (not fractional) that can be positive, negative, or zero | |
| Requirements: | |
| Print out what the two largest are inside of the function to start with. | |
| The List<int> that you pass in can be of any length, but not null | |
| (List<int>? type would be nullable) | |
| Do not use sort() | |
| The largest and second largest cannot be the same number | |
| If list were to change, consider nulls and print a statement for each scenario in main() |
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
| /* | |
| Create list of Names | |
| make a variable that is equal to what the user inputs in order to find that name | |
| Create a function that returns a list of names | |
| Parameters must reference the list and what the user inputs | |
| To check the names within the list you'll need a for in loop | |
| That loop will need an empy list to store any matches | |
| account for caplitalization | |
| - if user messes up be prepared by allowing the loop to automatically make sense of all letters | |
| -uppercase or lowercase |
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
| /* | |
| Make a list containing 4, 5, & 6 (integers) and name it | |
| Both requests ask to look for an object within a list, so for loops are needed for both | |
| void needs to be return type for sum as you're printing in the function and not returning anything | |
| return type of product function should be int (before the name of the function) | |
| as you need to return to main to print, | |
| also need to wrap in {} to make the parameter named | |
| print and returns go outside of the loop | |
| sum must start with 0 in order to account for the first number | |
| same logic for product, but must be 1 or all the values will be 0 |
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
| /* | |
| Create a variable that stores an integer that the user provides | |
| completing a repetitive task means using a for loop | |
| simple - so it can stay within main() - but can make a function if preferred | |
| Prime Number is a whole number greater than 1 that cannot be divided by any whole number | |
| other than itself and 1 | |
| Since 1 is valid, the initial check must start at 2 and go up from there | |
| - can add by one as you can check all numbers in between | |
| if statement with modulo will help determine if it is divisible by user given number | |
| - if it is then it's not prime so set that if statement to say false |
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
| /* | |
| All within main() to keep the requirements together | |
| must go through each number out of a bunch that's not in a list, so a for loop is best | |
| the count starts at one so it initializes on that number | |
| each number between must be analyzed including the last (100) | |
| each time a number is analyzed in order | |
| must use Modulo: returns the remainder of two integers when they are divided by each other | |
| order is necessary for FizzBuzz | |
| -it needs to print before any of the other words otherwise the wrong word would be printed | |
| -once an if statement finds something true, it stops its cycle |
NewerOlder