Post Reply 
syntax flexibility (programming) of xcas on HP-Prime
02-09-2019, 01:39 PM
Post: #2
RE: syntax flexibility (programming) of xcas on HP-Prime
Another example for IF-THEN-ELSE-END

PHP Code:
function AgeVote( )
begin 
    local Age

    
assumeAgeinteger );

    
DispGClrIOClrGraph

    
printf"How old are you?" );
    
inputAge );

    if 
Age ≥ 18 then
        printf
(  "Go vote!" );
    else
        
printf"Sorry, not yet" );
    
end_if

    
return Done;

end:;

AgeVote( ) :=


    
local Age
    
assumeAgeinteger );

    
DispGClrIOClrGraph

    
printf"How old are you?" );
    
inputAge );

    if (
Age>=18printf("Go vote!");   
    else 
printf("Sorry, not yet");  

    return 
Done;

}:;


AgeVote( ) :=

    
local Age
    
assumeAgeinteger );

    
DispGClrIOClrGraph

    
printf"How old are you?" );
    
inputAge );

    if (
Age >= 18
    {
        
printf(  "Go vote!" );
    }
    else
    {
        
printf"Sorry, not yet" );
    }
    
    return 
Done;
}:;


function 
AgeVote1( )
begin 
    local Age

    
assumeAgeinteger );

    
DispGClrIOClrGraph

    
printf"How old are you?" );
    
inputAge );

    if (
Age >= 18
        
begin
            printf
(  "Go vote!" );
        
end  
    
else
        
begin
            printf
"Sorry, not yet" );
        
end

    
return Done;

end 
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: syntax flexibility (programming) of xcas on HP-Prime - compsystems - 02-09-2019 01:39 PM



User(s) browsing this thread: 2 Guest(s)