Computer Science Canada Request - Can someone post a example of case selection? |
Author: | FeniX [ Fri Jun 20, 2003 8:50 am ] |
Post subject: | Request - Can someone post a example of case selection? |
If I am correct case selection has to do with if statements right? well thank you to whoever posts an example. |
Author: | Andy [ Fri Jun 20, 2003 9:47 am ] |
Post subject: | |
ya ur rite, its a simple way to do if statements |
Author: | krishon [ Fri Jun 20, 2003 9:53 am ] | ||
Post subject: | |||
yah..for example
|
Author: | Andy [ Fri Jun 20, 2003 9:56 am ] |
Post subject: | |
that looks like Ti 83+ plus programming |
Author: | krishon [ Fri Jun 20, 2003 9:57 am ] |
Post subject: | |
lol, TI 83+ programming is much worse...god it takes so long just to do a stupid quadratic formula program. |
Author: | Andy [ Wed Jun 25, 2003 11:43 am ] |
Post subject: | |
no it doesn't... making a quadratic program is easy, making a factoring program takes a long time |
Author: | naoki [ Fri Jun 27, 2003 11:09 pm ] |
Post subject: | |
case still sucks cuz it's getch. i'd prefer input.keydown myself case is sorta easier 2 work with |
Author: | AsianSensation [ Sat Jun 28, 2003 9:59 am ] |
Post subject: | |
naoki wrote: case still sucks cuz it's getch. i'd prefer input.keydown myself
???????????? case = getch? ???????????? I always thought case was an alternate if thingie. |
Author: | rizzix [ Sat Jun 28, 2003 10:32 am ] |
Post subject: | |
it is an alternate, but _restricted_, if statement syntax. just a cosmetic feature of the language. |
Author: | AsianSensation [ Sat Jun 28, 2003 10:42 am ] |
Post subject: | |
so why is case used if it is more restricted, and therefore, offers less options then if? Does it compile quicker or something? Or is it just more user friendly? (but if/then is very user friendly....I don't see how you can get more simpler by using case....) |
Author: | SilverSprite [ Sat Jun 28, 2003 12:18 pm ] |
Post subject: | |
why do they have more than one type of operating system? its all about preference |
Author: | naoki [ Sat Jun 28, 2003 1:36 pm ] |
Post subject: | |
get char case char of: label "A" put "Good job" that's basically like getch in a sense (but more towards if statements). |
Author: | Catalyst [ Sat Jun 28, 2003 2:01 pm ] |
Post subject: | |
it isnt like getch, its a basic language construct altho everything it does can be done using ifs and elsifs (or just ifs and elses for that matter) |
Author: | PaddyLong [ Sat Jun 28, 2003 2:25 pm ] | ||||
Post subject: | |||||
they are also very helpful in languages like Java where you don't have any elseif statement... just if and else... so like you could have (not using java syntax, but the idea...)
or you could just have (not using java syntax, but the idea...)
so probably it's in Turing to teach you (because as we all know, turing is just for learning to program ![]() |
Author: | Andy [ Mon Jun 30, 2003 8:24 am ] |
Post subject: | |
paddylong, is there no elsif in java? |
Author: | PaddyLong [ Mon Jun 30, 2003 11:44 am ] |
Post subject: | |
no there's not... I said that in the post |
Author: | SilverSprite [ Mon Jun 30, 2003 5:54 pm ] |
Post subject: | |
Well there really isnt an elsif on c++ either.. its just a compound of else and if statements.. or maybe i dont know what i'm talking about.. just something i noticed.. |
Author: | AsianSensation [ Mon Jun 30, 2003 6:00 pm ] | ||
Post subject: | |||
when you say compound else and if, is that this?
so isn't that the same as elsif? |
Author: | SilverSprite [ Mon Jun 30, 2003 6:08 pm ] | ||||
Post subject: | |||||
you know how in c++ you dont need braces if you only have one line after if or elsif or anything else? and you can put it on the same line as the if or the elsif or the for loop etc..? so in c++
would be equivalent to
so the if after the else would actually be a seperate if on its own just placed on the same line as the else.. |
Author: | rizzix [ Mon Jun 30, 2003 7:01 pm ] |
Post subject: | |
yea it's equivalent to elsif in turing (for Java/C/C++/Objective-C/Perl/PHP/it goes on and on...) don't worry, there is no drop in performance or anything as such. The Language designers (or what ever they are called probably Just Computer Scientists or Software Engineers) thought it is a better to have less unnecessary _keywords_ in a language thus making it compact, which i think is a good idea. |