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: r/>') ; d o c u m e nt.write ('Y o u m u s t ta ke th is c o u rs e a g a in!') ; Passed. You must take this course again! o W ro n g u tp u t Passed. (CS1301) Introduction to Computer Programming City Univ of HK / Dept of CS / Helena Wong } http://www.cs.cityu.edu.hk/~helena C o rre ct 4. Program Structure III - 7 Other Basics about JavaScript Enclose statements in braces { and } How do we indent { and } ? The following 2 ways are recommended: va r m a rk; m a rk=p ro m p t('Wh a t is yo u r m a rk? ','') ; if (m a rk>4 0 ) d o c u m e nt.write ('P a s s e d .') ; e ls e { d o c u m e nt.write ('Fa ile d .') ; d o c u m e nt.write ('<b r/>') ; d o c u m e nt.write ('T a ke th is c o u rs e a g a in!') ; va r m a rk; m a rk=p ro m p t('Wh a t is y o u r m a rk? ','') ; if (m a rk>4 0 ) d o c u m e nt.write ('P a s s e d .') ; e ls e { d o c u m e nt.write ('Fa ile d .') ; d o c u m e nt.write ('<b r/>') ; d o c u m e nt.write ('T a ke th is c o u rs e a g a in!') ; } } } -- should align with "else" { -- should align with } or after "else" (CS1301) Introdu...
View Full Document

This note was uploaded on 03/10/2012 for the course CS 1301 taught by Professor Dr.wong during the Winter '08 term at City University of Hong Kong.

Ask a homework question - tutors are online