cse 115
play

CSE 115 Introduction to Computer Science I Announcements Finish - PowerPoint PPT Presentation

CSE 115 Introduction to Computer Science I Announcements Finish module pre-lab *before* lab exam For each lab exam you have a second chance, after the next lab exam. Road map Review expressions/variables/assignment functions


  1. CSE 115 Introduction to Computer Science I

  2. Announcements Finish module pre-lab *before* lab exam For each lab exam you have a second chance, after the next lab exam.

  3. Road map ▶︎ Review ◀ expressions/variables/assignment functions JavaScript on codenvy.io

  4. Review Expressions Variables Assignment Defining functions: parameters, header, body Calling functions: arguments, returned value, environments Control flow: sequencing and selection (if/elif/else)

  5. Road map Review ▶︎ expressions/variables/assignment ◀ functions JavaScript on codenvy.io

  6. JavaScript expressions/variables/assignment Simple expressions: Literals (null, true, false, numeric literal, string literal) All numbers are floating point.

  7. JavaScript expressions/variables/assignment Compound expressions: binary: expression operator expression unary: operator expression or expression operator

  8. JavaScript expressions/variables/assignment Some binary operators: arithmetic: +, -, *, /, %, ** string: + relational: <, <=, >, >=, ==, != Boolean (short circuiting): &&, ||

  9. JavaScript expressions/variables/assignment Some unary operators: arithmetic: +, - Boolean: !

  10. JavaScript expressions/variables/assignment Variables must be declared before use, and statements end with ';' var x; x = 13; var y = 17;

  11. Road map Review expressions/variables/assignment ▶︎ functions ◀ JavaScript on codenvy.io

  12. JavaScript defining and calling functions Functions have same parts: header + body def area(w, h): function area(w, h) { return w * h return w * h; }

  13. JavaScript defining and calling functions keywords are di ff erent def area(w, h): function area(w, h) { return w * h return w * h; }

  14. JavaScript defining and calling functions Delimiters are di ff erent def area(w, h): function area(w, h) { return w * h return w * h; }

  15. Extra slide: this came up during class Delimiter names ( ) are parentheses (singular: parenthesis) [ ] are brackets { } are braces The first of each pair is an opening or left delimiter, the second is a closing or right delimiter.

  16. Extra slide: this came up during class Comments # This is a Python single-line comment // This is a JavaScript single-line comment /* This is a JavaScript comment that spans many lines. */

  17. Extra slide: this came up during class Additional Operators = assignment == equality under type conversion ("loose" equality) === equality without type conversion ("strict" equality) && logical AND || logical OR ! logical NOT & bitwise AND We'll explain these operators (and what we mean by | bitwise OR type conversion) later. ~ bitwise NOT

  18. JavaScript defining and calling functions statement terminators needed in JavaScript * def area(w, h): function area(w, h) { return w * h return w * h; } * While the language will allow semicolons to be omitted sometimes, it is safer to always insert them. This avoids subtle and di ffi cult to track down bugs which can otherwise occur.

  19. JavaScript defining and calling functions Functions calls look similar def area(w, h): function area(w, h) { return w * h return w * h; } x = area(3, 7) var x = area(3, 7);

  20. Printing print( 3 * 5 ) console.log( 3 * 5 );

  21. Road map Review expressions/variables/assignment functions ▶︎ JavaScript on codenvy.io ◀

  22. JavaScript on codenvy.io To code along: Create a workspace with 'node-defaut' stack Create custom run command with: commandLine: cd ${current.project.path} && node hello.js preview URL: http://${server.port.8000}

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend