Snippet. Vala. How to Calculate Velocity

This small Vala snippet will calculate the velocity of an object.

//======================== START OF FUNCTION ==========================//
// FUNCTION: calculate_velocity                                        //
//=====================================================================//
int calculate_velocity(int distance, int time) {
    int velocity = distance/time;
    return velocity;
         
}
//=====================================================================//
// FUNCTION: calculate_velocity                                        //
//========================= END OF FUNCTION ===========================//

Updated on: 25 Apr 2024