简体   繁体   中英

varID keyword in scala

Is varID some sort of a keyword in Scala? I am looking at some code and I see something like:

require(factor.varId == varId, "Can't multiply two factors: variable ids do not match")

I looked into the Factor class and it is defined as:

trait Factor {

    type FACTOR_TYPE <: Factor
    def getVariableIds(): Seq[Int]
    def *(factor: Factor): FACTOR_TYPE = throw new UnsupportedOperationException("Not supported")
}

I don't understand what this varID is from this definition. I am from a C++ background, so this is a bit new to me.

No, there is no such keyword. If you will check your code, you will find, that varId is passed or defined value/variable. If you are using IDE you can navigate to the definition.

Here is the list of Scala keywords:

abstract 
case 
catch 
class 
def 
do 
else 
extends 
false 
final 
finally 
for 
forSome 
if 
implicit 
import 
lazy 
match 
new 
null 
object 
override 
package 
private 
protected 
return 
sealed 
super 
this 
throw 
trait 
try 
true 
type 
val 
var 
while 
with 
yield 
_  
:  
=  
=> (⇒) 
<- (←) 
<:  
<%  
>:  
# 
@

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM