Lecture 3 Notes

14 y 1x z 42 cosy n 15 cos is a built in

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: (x < 10) 4.  5.  6.  7.  8.  9.  10.  *, / +, - <, <=, ==, ~=, >, >= & | && || 1/30/14 •  (5 < x) && (x < 6) •  How about 5 < x && x < 6? 11 1/30/14 12 1/31/14 Variables n༆  •  How can we express 5 < x < 6? Variable: a named computer memory space for storing a value r •  (5 < x) && (x < 6) •  How about 5 < x && x < 6? n༆  n༆  Valid names start with a letter, can contain digits Use meaningful variable names! Yes, but be careful. 1/30/14 13 1/30/14 14 Assignment Assignment n༆  •  Assignment puts a value into a variable •  Assignment operator is = •  Assignment statement r = 2*4.5;! •  Result r 9.0! •  Expression on right- hand- side (rhs) evaluated before its value is assigned to variable on leY- hand- side (lhs). 1/30/14 n༆  Expression on rhs is evaluated before the assignment operation Examples: x = 2*3.14 y = 1+x z = 4^2 – cos(y) n༆  15 cos is a built-in function 1/30/14 16 Assignment n༆  n༆  Assignment Expression on rhs is evalu...
View Full Document

This document was uploaded on 03/11/2014 for the course CSCI 004 at Brown.

Ask a homework question - tutors are online