Scratchpad

If you are new to Scratchpad, and want full access as a Scratchpad editor, create an account!
If you already have an account, log in and have fun!!

READ MORE

Scratchpad
Advertisement

This is an example of a beat. When the page body loads, the beat will cause the page to emit a one second beep every three seconds.


Example.<3[]

   //<3 Beat
   
   //In general, every beat will define what hearts are called in the HTML body.
    
   <body3
   
       //It's good practice to not redefine global methods in the body, just in case
       //you want to use the default values in another heart. That's why we're def-
       //ining our beep and tick inside a nested heart, called threeBeep.
   
       <threeBeep3
   
           //We define the beep method's properties by putting it in a heart.
   
           <beep3
   
               //Set frequency and time
   
               440. => freq;
               1::second => time;
           </3
   
           //Set up the three second ticker.
   
           <tick3
   
               //Time is three seconds.
   
               3::second => rate;
   
               //Every tick, we need it to beep, so...
   
               ^beep;
           </3
   
           //Lastly, set up the ticker...
   
           ^tick;
       </3
   </3
Advertisement