Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 some noob help with end when please
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
LasersGoPew




PostPosted: Fri Oct 27, 2006 8:04 am   Post subject: some noob help with end when please

Im working on an assignment for my class and im having trouble doing one thing. Here is my code
var text : string
var font, fontx : int
font:=Font.New("serif:20:bold")
%Anything with (font) will be size 20 and bold.
fontx:=Font.New("serif:30:bold")
%Anything with fontx will be size 30 and bold.
%These two lines show the size of the font, if its bold or not,and what kind of font it is.

drawfillbox(0, 0, maxx, maxx, black)
% This line shows that there will be a blakc background.

Font.Draw("Made by:", 230, 290, font, yellow)
% The numbers in the line indicate the coordinates on the screen where the text will start and end.
Font.Draw("Duke Sigulinski", 200, 240, font, green)
Font.Draw(" Dont run this program if you have sensitive eyes!", 5,190, font, brightred)
Font.Draw("You have been warned.",170,140,font,brightred)
delay(3000)cls
%This line will wait 5 seconds before going into the flashing text part of the program.
drawfillbox(0, 0, maxx, maxx, black)
Font.Draw(" Put your name here.",170,150,font,brightred)
locatexy (250,130)
get text : *

loop
drawfillbox(0, 0, maxx, maxx, black)
% This line shows that ther will be a black background, and the draw box means there will be a box on the whole screen.
Font.Draw(text, 260, 300, fontx, white)
Font.Draw("DONE YOUR HOMEWORK?!?", 60,70, fontx, white)
Font.Draw("are you..." ,250,170,fontx,white)
%This will display the flashing text in white.
delay(75)
%The 75 delay means that it will falsh from black to white and vise versa every 0.075 seconds.
drawfillbox(0, 0, maxx, maxx, white)
Font.Draw(text, 260, 300, fontx, black)
Font.Draw("DONE YOUR HOMEWORK?!?", 60, 70, fontx, black)
Font.Draw("are you...",250,170,fontx,black)
%This will display the flashing text in black
delay(75)
end loop

Ok so what i want to do is have it end the flashing after the user presses enter, then i will have it go to another screen. I just want ot know how to do end when press enter. Thanks for your help.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Oct 27, 2006 8:17 am   Post subject: (No subject)

you're looking for exit when condition. And it's just a shortcut for
code:

if condition then
   exit
end if

where exit exits out of the loop
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
LasersGoPew




PostPosted: Fri Oct 27, 2006 8:23 am   Post subject: (No subject)

allright so to make it end when i press enter it owuld besomehting like :
if getchar (enter) then
exit
end if
im really new and this is my first like week at this sorry lol[/u]
TokenHerbz




PostPosted: Fri Oct 27, 2006 9:09 am   Post subject: (No subject)

here try this code:

code:

var a: int

loop
    get a
    if a < 10 then
        exit
    end if
    put "in loop"
end loop
put "out loop"


enter in 45, then 22, and then 6.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: