Step-by-step solution for Check Nums
View the challenge

This challenge requires you to return the string "true" if the second integer parameter (num2) is larger than the first (num1). This is actually a very simple challenge which doesn't require a lot of code.

function CheckNums(num1, num2) { 

  // we use a ternary expression to write as little code as possible
  return (num2 === num1) ? '-1' : (num2 > num1) ? true : false;
         
}
   
CheckNums(3, 122);                            
def CheckNums(num1, num2): 

  if (num1 == num2):
    return '-1'
  elif (num2 > num1):
    return 'true'
  else:
   return 'false'
    
print CheckNums(3, 122)  
def CheckNums(num1, num2)

  if num1 == num2
    return '-1'
  elsif num2 > num1
    return 'true'
  else
    return 'false'
  end
         
end
   
puts CheckNums(STDIN.gets)   
Top User Solutions
1 hyuil Challenge Score: 10 Cpp
1 Qlogin Challenge Score: 10 Python
2 Sabin Challenge Score: 10 Python
1 junjunparkpark Challenge Score: 10 Ruby
1 cjordanball Challenge Score: 10 JavaScript
3 Corinto Challenge Score: 10 Python
4 mmalkavian Challenge Score: 10 Python
5 gzamfire Challenge Score: 10 Python
2 EmperorDuny Challenge Score: 10 JavaScript
2 lokeshmogra Challenge Score: 10 Cpp
6 cdms0 Challenge Score: 10 Python
3 jackgeek Challenge Score: 10 JavaScript
7 hurgadion Challenge Score: 10 Python
8 scates Challenge Score: 10 Python
9 ricky0309 Challenge Score: 10 Python
4 chrigolex Challenge Score: 10 JavaScript
10 philtroin Challenge Score: 10 Python
5 beeboop19 Challenge Score: 10 JavaScript
6 mattlarsh Challenge Score: 10 JavaScript
7 deuzen Challenge Score: 10 JavaScript
8 SuprDewd Challenge Score: 10 JavaScript
3 gutty333 Challenge Score: 10 Cpp
1 arjnklc Challenge Score: 10 Java
9 safetyscissors Challenge Score: 10 JavaScript
2 toasterbob Challenge Score: 10 Ruby
10 gladysum Challenge Score: 10 JavaScript
3 duncanbb Challenge Score: 10 Ruby
4 Bohdan Challenge Score: 10 Ruby
5 emuchynski Challenge Score: 10 Ruby
6 mienaineko Challenge Score: 10 Ruby
4 johne Challenge Score: 10 Cpp
7 randyjap Challenge Score: 10 Ruby
8 johncoleman83 Challenge Score: 10 Ruby
1 ionutforyou Challenge Score: 10 PHP
9 kelaiyarao1 Challenge Score: 10 Ruby
5 Justification Challenge Score: 10 Cpp
10 CoderAPS Challenge Score: 10 Ruby
2 tostercx Challenge Score: 10 PHP
6 Zeikar Challenge Score: 10 Cpp
2 danaksim Challenge Score: 10 Java
3 jakmaj Challenge Score: 10 Java
4 binfeng Challenge Score: 10 Java
7 anta0 Challenge Score: 10 Cpp
5 ph4ntom Challenge Score: 10 Java
8 lingqyzeng Challenge Score: 10 Cpp
9 amatakos Challenge Score: 10 Cpp
6 k8conant Challenge Score: 9 Java
7 nicklivens Challenge Score: 10 Java
8 KSmithson Challenge Score: 10 Java
10 gustavhafen Challenge Score: 10 Cpp
9 Vilya Challenge Score: 10 Java
3 longcheng Challenge Score: 10 PHP
4 torbjornperttu Challenge Score: 10 PHP
5 albionselimaj Challenge Score: 10 PHP
10 zawiczek Challenge Score: 10 Java
6 teplicko Challenge Score: 10 PHP
7 Althalus Challenge Score: 10 PHP
8 smcdowell Challenge Score: 10 PHP
9 jetonr Challenge Score: 10 PHP
10 copacubanana Challenge Score: 10 PHP