dimanche 19 avril 2015

Scheme: if condition with multiple procedures

I am trying to figure out how to have my if statement do multiple tasks, but only return one thing, if that makes sense. Also, I have no clue how to print a string along with a variable in the same line.


for example, how would you do something like this in scheme (the following is java)



if(num < x){
num++;
x = 0;
System.out.println("The value of x is " + x " and num is now" + num);
}


else System.out.println("error");


Here is what I tried:



(if (< num x)
( (define num (+ 1 num))
(define x 0)
;idk how to print it
)
"error";else
)

Aucun commentaire:

Enregistrer un commentaire